Struct compare::Swap [] [src]

pub struct Swap<C>(_);

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

impl<C, L: ?Sized, R: ?Sized> Compare<R, L> for Swap<C> where C: Compare<L, R>
[src]

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. Read more

fn compares_lt(&self, r: &R, l: &L) -> bool

Checks if l is less than r.

fn compares_le(&self, r: &R, l: &L) -> bool

Checks if l is less than or equal to r.

fn compares_ge(&self, r: &R, l: &L) -> bool

Checks if l is greater than or equal to r.

fn compares_gt(&self, r: &R, l: &L) -> bool

Checks if l is greater than r.

fn compares_eq(&self, r: &R, l: &L) -> bool

Checks if l is equal to r.

fn compares_ne(&self, r: &R, l: &L) -> bool

Checks if l is not equal to r.

fn borrowing(self) -> Borrowing<Self, L, R> where Self: Sized

Borrows the comparator's parameters before comparing them. Read more

fn rev(self) -> Rev<Self> where Self: Sized

Reverses the ordering of the comparator. Read more

fn swap(self) -> Swap<Self> where Self: Sized

Swaps the comparator's parameters, maintaining the underlying ordering. Read more

fn then<D>(self, then: D) -> Then<Self, D> where D: Compare<L, R>, Self: Sized

Lexicographically combines the comparator with another. Read more

Derived Implementations

impl<C: Debug> Debug for Swap<C>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<C: Eq> Eq for Swap<C>
[src]

impl<C: PartialEq> PartialEq for Swap<C>
[src]

fn eq(&self, __arg_0: &Swap<C>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Swap<C>) -> bool

This method tests for !=.

impl<C: Default> Default for Swap<C>
[src]

fn default() -> Swap<C>

Returns the "default value" for a type. Read more

impl<C: Copy> Copy for Swap<C>
[src]

impl<C: Clone> Clone for Swap<C>
[src]

fn clone(&self) -> Swap<C>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more