pub trait Lattice: JoinSemilattice + MeetSemilattice { }Expand description
A lattice: a type with both join (least upper bound) and meet (greatest lower bound) operations.
Laws (not enforced by type system):
- All join-semilattice laws for
join - All meet-semilattice laws for
meet - Absorption:
a.join(a.meet(b)) == aanda.meet(a.join(b)) == a
§Example
use algebra_core::{JoinSemilattice, MeetSemilattice, Lattice};
use std::collections::HashSet;
let a: HashSet<_> = [1, 2].into_iter().collect();
let b: HashSet<_> = [2, 3].into_iter().collect();
// join = union, meet = intersection
assert_eq!(a.join(&b), [1, 2, 3].into_iter().collect());
assert_eq!(a.meet(&b), [2].into_iter().collect());Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.