pub trait OrderExpectations<'e, T> {
// Required methods
fn to_be_less_than(self, value: T) -> Self;
fn to_be_less_than_or_equal(self, value: T) -> Self;
fn to_be_greater_than(self, value: T) -> Self;
fn to_be_greater_than_or_equal(self, value: T) -> Self;
fn to_be_inside<R: RangeBounds<T> + Debug + 'e>(self, range: R) -> Self;
}Expand description
Extension trait for ordering expectations
Required Methods§
Sourcefn to_be_less_than(self, value: T) -> Self
fn to_be_less_than(self, value: T) -> Self
Expect the value to be less than another value
let a = "abc";
let b = "def";
expect(a).to_be_less_than(b);asserts that a.lt(b) is true
Sourcefn to_be_less_than_or_equal(self, value: T) -> Self
fn to_be_less_than_or_equal(self, value: T) -> Self
Expect the value to be less than or equal to another value
let a = "abc";
let b = "abc";
let c = "def";
expect(a).to_be_less_than_or_equal(b);
expect(a).to_be_less_than_or_equal(c);asserts that a.le(b) is true
Sourcefn to_be_greater_than(self, value: T) -> Self
fn to_be_greater_than(self, value: T) -> Self
Expect the value to be greater than another value
let a = "def";
let b = "abc";
expect(a).to_be_greater_than(b);asserts that a.gt(b) is true
Sourcefn to_be_greater_than_or_equal(self, value: T) -> Self
fn to_be_greater_than_or_equal(self, value: T) -> Self
Expect the value to be greater than or equal to another value
let a = "def";
let b = "def";
let c = "abc";
expect(a).to_be_greater_than_or_equal(b);
expect(a).to_be_greater_than_or_equal(c);asserts that a.ge(b) is true
Sourcefn to_be_inside<R: RangeBounds<T> + Debug + 'e>(self, range: R) -> Self
fn to_be_inside<R: RangeBounds<T> + Debug + 'e>(self, range: R) -> Self
Expect the value to be inside a range
let a = 5;
let range = 1..10;
expect(a).to_be_inside(range);asserts that a is inside range
It works with inclusive ranges as well
let a = 10;
let range = 1..=10;
expect(a).to_be_inside(range);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.