Trait Approx

Source
pub trait Approx {
    // Required method
    fn approx_distance_to(&self, other: &Self) -> f32;

    // Provided methods
    fn approx_eq(&self, other: &Self) -> bool { ... }
    fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool { ... }
}
Expand description

Implement this for types you want to check for approximate equality

Required Methods§

Source

fn approx_distance_to(&self, other: &Self) -> f32

Get an approximated distance between two values

Provided Methods§

Source

fn approx_eq(&self, other: &Self) -> bool

Check if values are approximately equal using DEFAULT_EPS

Source

fn approx_eq_eps(&self, other: &Self, eps: f32) -> bool

Check if values are approximately equal using supplied eps value

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.

Implementors§

Source§

impl<T: Float> Approx for T