Struct compare::Natural [] [src]

pub struct Natural<T: Ord + ?Sized>(_);

A comparator that delegates to Ord.

Examples

use compare::{Compare, natural};
use std::cmp::Ordering::{Less, Equal, Greater};

let a = &1;
let b = &2;

let cmp = natural();
assert_eq!(cmp.compare(a, b), Less);
assert_eq!(cmp.compare(b, a), Greater);
assert_eq!(cmp.compare(a, a), Equal);

Trait Implementations

impl<T: Ord + ?Sized> Compare<T> for Natural<T>

fn compare(&self, l: &T, r: &T) -> Ordering

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

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

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

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

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

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

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

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

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

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

impl<T: Ord + ?Sized> Clone for Natural<T>

fn clone(&self) -> Self

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

impl<T: Ord + ?Sized> Copy for Natural<T>

impl<T: Ord + ?Sized> Default for Natural<T>

fn default() -> Self

impl<T: Ord + ?Sized> PartialEq for Natural<T>

fn eq(&self, _other: &Self) -> bool

1.0.0fn ne(&self, other: &Rhs) -> bool

impl<T: Ord + ?Sized> Eq for Natural<T>

impl<T: Ord + ?Sized> Debug for Natural<T>

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