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§
Provided Methods§
Sourcefn is_less_or_equal(&self, other: &TOther) -> bool
fn is_less_or_equal(&self, other: &TOther) -> bool
Checks if self <= other
. This should be equivalent to self < other || self == other
.
Sourcefn is_greater(&self, other: &TOther) -> bool
fn is_greater(&self, other: &TOther) -> bool
Checks if self > other
. This should be equivalent to !(self <= other)
.
Sourcefn is_greater_or_equal(&self, other: &TOther) -> bool
fn is_greater_or_equal(&self, other: &TOther) -> bool
Checks if self >= other
. This should be equivalent to self > other || self == other
.
Sourcefn is_not_equal(&self, other: &TOther) -> bool
fn is_not_equal(&self, other: &TOther) -> bool
Checks if self != other
. This should be equivalent to !(self == other)
.