pub struct Dual<T>(pub T);
Expand description
A wrapper type that swaps (<=
and >=
) for PartialOrd
s, (meet
and join
) for Lattice
s,
and (top
and bottom
) for BoundedLattice
s.
§Example
assert!(Dual(2) < Dual(1));
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T> BoundedLattice for Dual<T>where
T: BoundedLattice,
impl<T> BoundedLattice for Dual<T>where
T: BoundedLattice,
Source§impl<T> Lattice for Dual<T>where
T: Lattice,
impl<T> Lattice for Dual<T>where
T: Lattice,
Source§fn meet(self, other: Dual<T>) -> Dual<T>
fn meet(self, other: Dual<T>) -> Dual<T>
The greatest lower bound of two elements.
meet(x, y)
is the biggest value z
s.t. z <= x
and z <= y
Source§fn join(self, other: Dual<T>) -> Dual<T>
fn join(self, other: Dual<T>) -> Dual<T>
The least upper bound of two elements.
join(x, y)
is the smallest value z
s.t. z >= x
and z >= y
.Source§impl<T> Ord for Dual<T>where
T: Ord,
impl<T> Ord for Dual<T>where
T: Ord,
Source§impl<T> PartialOrd for Dual<T>where
T: PartialOrd,
impl<T> PartialOrd for Dual<T>where
T: PartialOrd,
impl<T> Copy for Dual<T>where
T: Copy,
impl<T> Eq for Dual<T>where
T: Eq,
impl<T> StructuralPartialEq for Dual<T>
Auto Trait Implementations§
impl<T> Freeze for Dual<T>where
T: Freeze,
impl<T> RefUnwindSafe for Dual<T>where
T: RefUnwindSafe,
impl<T> Send for Dual<T>where
T: Send,
impl<T> Sync for Dual<T>where
T: Sync,
impl<T> Unpin for Dual<T>where
T: Unpin,
impl<T> UnwindSafe for Dual<T>where
T: UnwindSafe,
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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