Trait ComparisonOps

Source
pub trait ComparisonOps {
    // Required methods
    fn equal(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
    fn not_equal(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
    fn less_than(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
    fn less_than_equal(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
    fn greater_than(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
    fn greater_than_equal(&self, other: &Self) -> Result<Self, String>
       where Self: Sized;
}
Expand description

Comparison operations on values

Required Methods§

Source

fn equal(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if two values are equal.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the equality comparison
  • An error message if the types cannot be compared
Source

fn not_equal(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if two values are not equal.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the inequality comparison
  • An error message if the types cannot be compared
Source

fn less_than(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if one value is less than another.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the less-than comparison
  • An error message if the types cannot be compared
Source

fn less_than_equal(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if one value is less than or equal to another.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the less-than-or-equal comparison
  • An error message if the types cannot be compared
Source

fn greater_than(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if one value is greater than another.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the greater-than comparison
  • An error message if the types cannot be compared
Source

fn greater_than_equal(&self, other: &Self) -> Result<Self, String>
where Self: Sized,

Tests if one value is greater than or equal to another.

§Arguments
  • other - The other value to compare
§Returns
  • The result of the greater-than-or-equal comparison
  • An error message if the types cannot be compared

Implementors§