Trait AssertOrder

Source
pub trait AssertOrder<E> {
    // Required methods
    fn is_less_than(self, expected: E) -> Self;
    fn is_greater_than(self, expected: E) -> Self;
    fn is_at_most(self, expected: E) -> Self;
    fn is_at_least(self, expected: E) -> Self;
}
Expand description

Assert whether a value is greater than or less than another value, as well as at most as big or at least as big as another value.

These assertions are implemented for all types that implement PartialOrd<E> with E being the type of the expected value the subject is being compared to.

§Examples

use asserting::prelude::*;

let some_result: u16 = 42;

assert_that!(some_result).is_at_most(43);
assert_that!(some_result).is_at_most(42);
assert_that!(some_result).is_at_least(42);
assert_that!(some_result).is_at_least(41);
assert_that!(some_result).is_greater_than(41);
assert_that!(some_result).is_less_than(43);

Required Methods§

Source

fn is_less_than(self, expected: E) -> Self

Verifies that the subject is less than some expected value.

Source

fn is_greater_than(self, expected: E) -> Self

Verifies that the subject is greater than some expected value.

Source

fn is_at_most(self, expected: E) -> Self

Verifies that the subject is less than or equal to some expected value.

Source

fn is_at_least(self, expected: E) -> Self

Verifies that the subject is greater than or equal to some expected 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.

Implementors§

Source§

impl<S, E, R> AssertOrder<E> for Spec<'_, S, R>
where S: PartialOrd<E> + Debug, E: Debug, R: FailingStrategy,