pub struct All(pub bool);Expand description
Newtype wrapper for bool where join is logical AND.
All(bool) forms a join-semilattice under the dual boolean order
(true < false):
All(a).join(&All(b)) == All(a && b)- Bottom element is
All(true)
This is useful for combining boolean conditions where “all must be true”, such as validation checks, preconditions, or invariants.
Note: The dual order may seem counterintuitive, but it makes AND
the join operation (least upper bound). This mirrors how Min uses
the dual order to make min the join.
§Example
use algebra::All;
use algebra::JoinSemilattice;
let a = All(true);
let b = All(false);
assert_eq!(a.join(&b), All(false));Tuple Fields§
§0: boolTrait Implementations§
Source§impl BoundedJoinSemilattice for All
impl BoundedJoinSemilattice for All
Source§fn 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 ⊥. Read more
Source§impl<'de> Deserialize<'de> for All
impl<'de> Deserialize<'de> for All
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JoinSemilattice for All
impl JoinSemilattice for All
Source§fn join_assign(&mut self, other: &Self)
fn join_assign(&mut self, other: &Self)
In-place variant.
Source§fn leq(&self, other: &Self) -> boolwhere
Self: PartialEq,
fn leq(&self, other: &Self) -> boolwhere
Self: PartialEq,
Derived partial order: x ≤ y iff x ⊔ y = y.
Source§fn join_all<I>(it: I) -> Option<Self>where
I: IntoIterator<Item = Self>,
fn join_all<I>(it: I) -> Option<Self>where
I: IntoIterator<Item = Self>,
Join a finite iterator of values. Returns
None for empty
iterators.Source§impl Named for All
impl Named for All
Source§fn typename() -> &'static str
fn typename() -> &'static str
The globally unique type name for the type.
This should typically be the fully qualified Rust name of the type.
Source§fn typehash() -> u64
fn typehash() -> u64
A globally unique hash for this type.
TODO: actually enforce perfect hashing
§fn typeid() -> TypeId
fn typeid() -> TypeId
The TypeId for this type. TypeIds are unique only within a binary,
and should not be used for global identification.
§fn port() -> u64
fn port() -> u64
The globally unique port for this type. Typed ports are in the range
of 1<<63..1<<64-1.
impl Copy for All
impl Eq for All
impl StructuralPartialEq for All
Auto Trait Implementations§
impl Freeze for All
impl RefUnwindSafe for All
impl Send for All
impl Sync for All
impl Unpin for All
impl UnwindSafe for All
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more