pub trait BoundedJoinSemilattice: JoinSemilattice {
// Required method
fn bottom() -> Self;
// Provided method
fn join_all_from_bottom<I>(it: I) -> Self
where I: IntoIterator<Item = Self> { ... }
}Expand description
A bounded join-semilattice: a join-semilattice with a bottom element that serves as the identity for join.
Laws (not enforced by type system):
- Associative:
a.join(b).join(c) == a.join(b.join(c)) - Commutative:
a.join(b) == b.join(a) - Idempotent:
a.join(a) == a - Identity:
bottom().join(a) == a == a.join(bottom())
The bottom element (⊥) is the least element in the partial order.
§Example
use algebra::BoundedJoinSemilattice;
use algebra::JoinSemilattice;
use algebra::Max;
let a = Max(10);
// bottom = minimum value
let bottom = Max::<i32>::bottom();
// Identity law
assert_eq!(bottom.join(&a), a);
assert_eq!(a.join(&bottom), a);Required Methods§
Provided Methods§
Sourcefn join_all_from_bottom<I>(it: I) -> Selfwhere
I: IntoIterator<Item = Self>,
fn join_all_from_bottom<I>(it: I) -> Selfwhere
I: IntoIterator<Item = Self>,
Join a finite iterator of values, starting from ⊥.
Never returns None: an empty iterator produces bottom().
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.