Trait Compare

Source
pub trait Compare<TOther> {
    // Required methods
    fn is_less(&self, other: &TOther) -> bool;
    fn is_equal(&self, other: &TOther) -> bool;

    // Provided methods
    fn is_less_or_equal(&self, other: &TOther) -> bool { ... }
    fn is_greater(&self, other: &TOther) -> bool { ... }
    fn is_greater_or_equal(&self, other: &TOther) -> bool { ... }
    fn is_not_equal(&self, other: &TOther) -> bool { ... }
}
Expand description

Represents a comparer for two values.

Required Methods§

Source

fn is_less(&self, other: &TOther) -> bool

Checks if self < other.

Source

fn is_equal(&self, other: &TOther) -> bool

Checks if self == other.

Provided Methods§

Source

fn is_less_or_equal(&self, other: &TOther) -> bool

Checks if self <= other. This should be equivalent to self < other || self == other.

Source

fn is_greater(&self, other: &TOther) -> bool

Checks if self > other. This should be equivalent to !(self <= other).

Source

fn is_greater_or_equal(&self, other: &TOther) -> bool

Checks if self >= other. This should be equivalent to self > other || self == other.

Source

fn is_not_equal(&self, other: &TOther) -> bool

Checks if self != other. This should be equivalent to !(self == other).

Implementors§

Source§

impl<T, K> Compare<K> for T
where T: Ord, K: Borrow<T>,