pub trait CanonicalEq {
// Required method
fn eq_canonical(&self, other: &Self) -> bool;
}Expand description
Total equivalence relation of IEEE 754 floating-point encoded types.
CanonicalEq agrees with the total ordering provided by CanonicalOrd. See the module
documentation for more. Given the set of NaN representations $N$, CanonicalEq expresses:
$$ \begin{aligned} a=b&\mid a\in{N},~b\in{N}\cr[1em] n\ne x&\mid n\in{N},~x\notin{N} \end{aligned} $$
§Examples
Comparing NaNs using primitive floating-point types:
use decorum::cmp::CanonicalEq;
let x = 0.0f64 / 0.0; // `NaN`.
let y = f64::INFINITY - f64::INFINITY; // `NaN`.
assert!(x.eq_canonical(&y));Required Methods§
fn eq_canonical(&self, other: &Self) -> bool
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.