pub struct Swap<C>(/* private fields */);Expand description
A comparator that swaps another’s parameters, maintaining the underlying ordering.
This is useful for providing a comparator C: Compare<T, U> in a context that
expects C: Compare<U, T>.
See Compare::swap for an example.
Trait Implementations§
Source§impl<C, L: ?Sized, R: ?Sized> Compare<R, L> for Swap<C>where
C: Compare<L, R>,
impl<C, L: ?Sized, R: ?Sized> Compare<R, L> for Swap<C>where
C: Compare<L, R>,
Source§fn compare(&self, r: &R, l: &L) -> Ordering
fn compare(&self, r: &R, l: &L) -> Ordering
Compares two values, returning
Less, Equal, or Greater if l is less
than, equal to, or greater than r, respectively.Source§fn borrowing(self) -> Borrowing<Self, L, R>where
Self: Sized,
fn borrowing(self) -> Borrowing<Self, L, R>where
Self: Sized,
Borrows the comparator’s parameters before comparing them. Read more
Source§fn rev(self) -> Rev<Self>where
Self: Sized,
fn rev(self) -> Rev<Self>where
Self: Sized,
Reverses the ordering of the comparator. Read more
impl<C: Copy> Copy for Swap<C>
impl<C: Eq> Eq for Swap<C>
impl<C> StructuralPartialEq for Swap<C>
Auto Trait Implementations§
impl<C> Freeze for Swap<C>where
C: Freeze,
impl<C> RefUnwindSafe for Swap<C>where
C: RefUnwindSafe,
impl<C> Send for Swap<C>where
C: Send,
impl<C> Sync for Swap<C>where
C: Sync,
impl<C> Unpin for Swap<C>where
C: Unpin,
impl<C> UnwindSafe for Swap<C>where
C: 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