Skip to main content

Float

Trait Float 

Source
pub trait Float:
    Sealed
    + Copy
    + PartialOrd
    + Debug {
    // Required methods
    fn abs_diff(self, other: Self) -> Self;
    fn float_is_nan(self) -> bool;
    fn float_is_finite(self) -> bool;
}
Expand description

A floating-point type the numeric matchers operate on.

Sealed: implemented for f32 and f64 only, so adding a method here is never a breaking change for downstream code.

Required Methods§

Source

fn abs_diff(self, other: Self) -> Self

The absolute difference between self and other.

Source

fn float_is_nan(self) -> bool

Whether self is NaN.

Source

fn float_is_finite(self) -> bool

Whether self is neither infinite nor NaN.

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 Float for f32

Source§

impl Float for f64

Implementors§