Distance

Trait Distance 

Source
pub trait Distance<T = Self> {
    type Output;

    // Required method
    fn distance(&self, other: T) -> Self::Output;
}
Expand description

Is implemented by basic types to calculate distances.

Required Associated Types§

Required Methods§

Source

fn distance(&self, other: T) -> Self::Output

Computes the absolute distance between two values.

Parameters:

  • other: specifies the value whose distance is calculated to self

Returns the absolute difference, i.e. distance between the two given values as a new instance.

Implementors§

Source§

impl<Integer: Into<Z>> Distance<Integer> for Z

Source§

impl<Integer: Into<Z>> Distance<Integer> for Modulus

Source§

impl<Rational: Into<Q>> Distance<Rational> for Q