Distance

Trait Distance 

Source
pub trait Distance {
    // Required method
    fn distance(self, other: Self) -> f32;
}
Expand description

Distance trait for calculating the distance between two values. It’s necessary for animation along a path in Keyframes::poly_to. The lib provides implementations for primitive types and tuples.

Required Methods§

Source

fn distance(self, other: Self) -> f32

Calculate the distance between two values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Distance for bool

Source§

fn distance(self, other: bool) -> f32

Source§

impl Distance for f32

Source§

fn distance(self, other: f32) -> f32

Source§

impl Distance for f64

Source§

fn distance(self, other: f64) -> f32

Source§

impl Distance for i8

Source§

fn distance(self, other: i8) -> f32

Source§

impl Distance for i16

Source§

fn distance(self, other: i16) -> f32

Source§

impl Distance for i32

Source§

fn distance(self, other: i32) -> f32

Source§

impl Distance for i64

Source§

fn distance(self, other: i64) -> f32

Source§

impl Distance for i128

Source§

fn distance(self, other: i128) -> f32

Source§

impl Distance for isize

Source§

fn distance(self, other: isize) -> f32

Source§

impl Distance for u8

Source§

fn distance(self, other: u8) -> f32

Source§

impl Distance for u16

Source§

fn distance(self, other: u16) -> f32

Source§

impl Distance for u32

Source§

fn distance(self, other: u32) -> f32

Source§

impl Distance for u64

Source§

fn distance(self, other: u64) -> f32

Source§

impl Distance for u128

Source§

fn distance(self, other: u128) -> f32

Source§

impl Distance for ()

Source§

fn distance(self, _: ()) -> f32

Source§

impl Distance for usize

Source§

fn distance(self, other: usize) -> f32

Source§

impl<T1, T2> Distance for (T1, T2)
where T1: Distance, T2: Distance,

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T1, T2, T3> Distance for (T1, T2, T3)
where T1: Distance, T2: Distance, T3: Distance,

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T1, T2, T3, T4> Distance for (T1, T2, T3, T4)
where T1: Distance, T2: Distance, T3: Distance, T4: Distance,

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T: Distance + Clone, const N: usize> Distance for [T; N]

Source§

fn distance(self, other: Self) -> f32

Source§

impl<T: Distance> Distance for (T,)

Source§

fn distance(self, other: Self) -> f32

Implementors§