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>
[src]

Compares two values, returning Less, Equal, or Greater if l is less than, equal to, or greater than r, respectively. Read more

Checks if l is less than r.

Checks if l is less than or equal to r.

Checks if l is greater than or equal to r.

Checks if l is greater than r.

Checks if l is equal to r.

Checks if l is not equal to r.

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

Reverses the ordering of the comparator. Read more

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

Lexicographically combines the comparator with another. Read more

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

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

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

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

This method tests for !=.

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

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

Formats the value using the given formatter.