Trait gardiz::bits::Distance

source ·
pub trait Distance<Rhs> {
    type Output;

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

Trait for computing absolute distance between two numbers. In general, types should not worry with this trait, but instead implement Sub and Ord.

Required Associated Types§

source

type Output

Output number type.

Required Methods§

source

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

Computes the absolute (without sign) distance between the given two numbers.

Implementors§

source§

impl<A> Distance<A> for Awhere A: Ord + Sub<Self>,

§

type Output = <A as Sub<A>>::Output