Skip to main content

ThresholdOrd

Trait ThresholdOrd 

Source
pub trait ThresholdOrd<T> {
    // Required method
    fn tcmp(&self, other: &T, threshold: T) -> Ordering;
}
Expand description

Trait for comparing two numbers with an threshold.

Returns:

  • Ordering::Greater if self is greater than other + threshold.
  • Ordering::Less if self is less than other - threshold.
  • Ordering::Equal otherwise.

Required Methods§

Source

fn tcmp(&self, other: &T, threshold: T) -> Ordering

Compare if self is threshold greater or less than other.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> ThresholdOrd<T> for T
where T: Ord + PartialOrd + Copy + Clone + Zero + Saturating,