NumAssertions

Trait NumAssertions 

Source
pub trait NumAssertions<T: Num> {
    // Required methods
    fn is_zero(self) -> Self;
    fn is_additive_identity(self) -> Self;
    fn is_one(self) -> Self;
    fn is_multiplicative_identity(self) -> Self;
    fn is_negative(self) -> Self
       where T: Signed;
    fn is_positive(self) -> Self
       where T: Signed;
    fn is_close_to(self, expected: T, allowed_deviation: T) -> Self
       where T: PartialOrd + Clone;
    fn is_nan(self) -> Self
       where T: Float;
    fn is_finite(self) -> Self
       where T: Float;
    fn is_infinite(self) -> Self
       where T: Float;
}
Expand description

Assertions for numeric values not already handled by crate::prelude::PartialEqAssertions and crate::prelude::PartialOrdAssertions.

Required Methods§

Source

fn is_zero(self) -> Self

Fails if actual is not equal to the additive identity.

Source

fn is_additive_identity(self) -> Self

Source

fn is_one(self) -> Self

Fails if actual is not equal to the multiplicative identity.

Source

fn is_multiplicative_identity(self) -> Self

Source

fn is_negative(self) -> Self
where T: Signed,

Source

fn is_positive(self) -> Self
where T: Signed,

Source

fn is_close_to(self, expected: T, allowed_deviation: T) -> Self
where T: PartialOrd + Clone,

Fails if actual is not in the range [expected - allowed_deviation, expected + allowed_deviation].

Source

fn is_nan(self) -> Self
where T: Float,

Source

fn is_finite(self) -> Self
where T: Float,

Source

fn is_infinite(self) -> Self
where T: Float,

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: Num + Debug, M: Mode> NumAssertions<T> for AssertThat<'_, T, M>