pub trait BoundedMeetSemilattice: MeetSemilattice {
// Required method
fn top() -> Self;
// Provided method
fn meet_all_from_top<I>(it: I) -> Self
where I: IntoIterator<Item = Self> { ... }
}Expand description
A bounded meet-semilattice: a meet-semilattice with a top element.
Laws (not enforced by type system):
- Associative:
a.meet(b).meet(c) == a.meet(b.meet(c)) - Commutative:
a.meet(b) == b.meet(a) - Idempotent:
a.meet(a) == a - Identity:
top().meet(a) == a == a.meet(top())
The top element (⊤) is the greatest element in the partial order.
§Example
use algebra_core::{BoundedMeetSemilattice, MeetSemilattice};
// For bool: top = true, meet = AND
let a = true;
let top = bool::top();
assert_eq!(top, true);
assert_eq!(top.meet(&a), a);
assert_eq!(a.meet(&top), a);Required Methods§
Provided Methods§
Sourcefn meet_all_from_top<I>(it: I) -> Selfwhere
I: IntoIterator<Item = Self>,
fn meet_all_from_top<I>(it: I) -> Selfwhere
I: IntoIterator<Item = Self>,
Meet a finite iterator of values, starting from ⊤.
Never returns None: an empty iterator produces top().
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.