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>
impl<T> BoundedLattice for Dual<T>
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> PartialEq for Dual<T>where
T: PartialEq,
impl<T> PartialEq for Dual<T>where
T: PartialEq,
source§impl<T> PartialOrd for Dual<T>where
T: PartialOrd,
impl<T> PartialOrd for Dual<T>where
T: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<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