pub trait ApproxEq<Eps> {
// Required methods
fn approx_epsilon() -> Eps;
fn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool;
// Provided method
fn approx_eq(&self, other: &Self) -> bool { ... }
}Expand description
Trait for testing approximate equality
Required Methods§
Sourcefn approx_epsilon() -> Eps
fn approx_epsilon() -> Eps
Default epsilon value
Sourcefn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool
fn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool
Returns true if this object is approximately equal to the other one, using
a provided epsilon value.
Provided Methods§
Sourcefn approx_eq(&self, other: &Self) -> bool
fn approx_eq(&self, other: &Self) -> bool
Returns true if this object is approximately equal to the other one, using
the approx_epsilon epsilon 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.
Implementations on Foreign Types§
Source§impl ApproxEq<f32> for f32
impl ApproxEq<f32> for f32
fn approx_epsilon() -> f32
fn approx_eq_eps(&self, other: &f32, approx_epsilon: &f32) -> bool
Source§impl ApproxEq<f64> for f64
impl ApproxEq<f64> for f64
fn approx_epsilon() -> f64
fn approx_eq_eps(&self, other: &f64, approx_epsilon: &f64) -> bool
Implementors§
impl<T, Src, Dst> ApproxEq<T> for Rotation2D<T, Src, Dst>
impl<T, Src, Dst> ApproxEq<T> for Rotation3D<T, Src, Dst>
impl<T: ApproxEq<T>> ApproxEq<T> for Angle<T>
impl<T: ApproxEq<T>, Src, Dst> ApproxEq<T> for ScaleOffset2D<T, Src, Dst>
impl<T: ApproxEq<T>, Src, Dst> ApproxEq<T> for Transform2D<T, Src, Dst>
impl<T: ApproxEq<T>, Src, Dst> ApproxEq<T> for Transform3D<T, Src, Dst>
impl<T: ApproxEq<T>, U> ApproxEq<Point2D<T, U>> for Point2D<T, U>
impl<T: ApproxEq<T>, U> ApproxEq<Point3D<T, U>> for Point3D<T, U>
impl<T: ApproxEq<T>, U> ApproxEq<Vector2D<T, U>> for Vector2D<T, U>
impl<T: ApproxEq<T>, U> ApproxEq<Vector3D<T, U>> for Vector3D<T, U>
impl<U, T: ApproxEq<T>> ApproxEq<T> for Length<T, U>
Available on crate features
std or libm only.