pub trait AbsDiffEq<Rhs = Self>: PartialEq<Rhs>where
Rhs: ?Sized,{
type Epsilon;
// Required methods
fn default_epsilon() -> Self::Epsilon;
fn abs_diff_eq(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool;
// Provided method
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool { ... }
}
Expand description
Equality that is defined using the absolute difference of two numbers.
Required Associated Types§
Required Methods§
Sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together.
This is used when no epsilon
value is supplied to the [abs_diff_eq!
], [relative_eq!
],
or [ulps_eq!
] macros.
Sourcefn abs_diff_eq(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Provided Methods§
Sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
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.