pub trait IterableCountExpectations<'e, B>where
B: ExpectationBuilder<'e>,{
// Required methods
fn count(self) -> impl ExpectationBuilder<'e, Value = usize>
where Self: Sized;
fn to_not_be_empty(self) -> Self;
fn to_be_empty(self) -> Self;
}Expand description
Extension trait for equality expectations for iterables
Required Methods§
Sourcefn count(self) -> impl ExpectationBuilder<'e, Value = usize>where
Self: Sized,
fn count(self) -> impl ExpectationBuilder<'e, Value = usize>where
Self: Sized,
Make expectations on the number of items in the iterable.
Don’t call this on never-ending iterables.
let items = vec!["bar", "foo", "foo"];
expect(items).count().to_be_greater_than_or_equal(2);asserts that items contains at least 2 items
Sourcefn to_not_be_empty(self) -> Self
fn to_not_be_empty(self) -> Self
Expect an iterable to not be empty.
let items = vec!["bar", "foo", "foo"];
expect(items).to_not_be_empty();asserts that items contains at least one item
Sourcefn to_be_empty(self) -> Self
fn to_be_empty(self) -> Self
Expect an iterable to be empty.
let items: Vec<u8> = vec![];
expect(items).to_be_empty();asserts that items contains no items
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.