Trait core::cmp::PartialOrd[src]

pub trait PartialOrd: PartialEq {
    fn lt(&self, other: &Self) -> bool;

    fn le(&self, other: &Self) -> bool { ... }
    fn gt(&self, other: &Self) -> bool { ... }
    fn ge(&self, other: &Self) -> bool { ... }
}

Trait for values that can be compared for a sort-order.

PartialOrd only requires implementation of the lt method, with the others generated from default implementations.

However it remains possible to implement the others separately for types which do not have a total order. For example, for floating point numbers, NaN < 0 == false and NaN >= 0 == false (cf. IEEE 754-2008 section 5.11).

Required Methods

fn lt(&self, other: &Self) -> bool

This method tests less than (for self and other) and is used by the < operator.

Provided Methods

fn le(&self, other: &Self) -> bool

This method tests less than or equal to (<=).

fn gt(&self, other: &Self) -> bool

This method tests greater than (>).

fn ge(&self, other: &Self) -> bool

This method tests greater than or equal to (>=).

Implementors