pub struct ContainsMatcher<InnerMatcherT> { /* private fields */ }Expand description
A matcher which matches a container containing one or more elements a given
inner Matcher matches.
Implementations§
Source§impl<InnerMatcherT> ContainsMatcher<InnerMatcherT>
impl<InnerMatcherT> ContainsMatcher<InnerMatcherT>
Sourcepub fn times(self, count: impl Matcher<usize> + 'static) -> Self
pub fn times(self, count: impl Matcher<usize> + 'static) -> Self
Configures this instance to match containers which contain a number of
matching items matched by count.
For example, to assert that exactly three matching items must be present, use:
ⓘ
contains(...).times(eq(3))One can also use times(eq(0)) to test for the absence of an item
matching the expected value.
Trait Implementations§
Source§impl<T: Debug + Copy, InnerMatcherT: Matcher<T>, ContainerT> Matcher<ContainerT> for ContainsMatcher<InnerMatcherT>
impl<T: Debug + Copy, InnerMatcherT: Matcher<T>, ContainerT> Matcher<ContainerT> for ContainsMatcher<InnerMatcherT>
Source§fn matches(&self, actual: ContainerT) -> MatcherResult
fn matches(&self, actual: ContainerT) -> MatcherResult
Returns whether the condition matches the datum
actual. Read moreSource§fn explain_match(&self, actual: ContainerT) -> Description
fn explain_match(&self, actual: ContainerT) -> Description
Source§fn describe(&self, matcher_result: MatcherResult) -> Description
fn describe(&self, matcher_result: MatcherResult) -> Description
Returns a description of
self or a negative description if
matcher_result is DoesNotMatch. Read moreSource§impl<InnerMatcherT> MatcherBase for ContainsMatcher<InnerMatcherT>
impl<InnerMatcherT> MatcherBase for ContainsMatcher<InnerMatcherT>
Auto Trait Implementations§
impl<InnerMatcherT> Freeze for ContainsMatcher<InnerMatcherT>where
InnerMatcherT: Freeze,
impl<InnerMatcherT> !RefUnwindSafe for ContainsMatcher<InnerMatcherT>
impl<InnerMatcherT> !Send for ContainsMatcher<InnerMatcherT>
impl<InnerMatcherT> !Sync for ContainsMatcher<InnerMatcherT>
impl<InnerMatcherT> Unpin for ContainsMatcher<InnerMatcherT>where
InnerMatcherT: Unpin,
impl<InnerMatcherT> UnsafeUnpin for ContainsMatcher<InnerMatcherT>where
InnerMatcherT: UnsafeUnpin,
impl<InnerMatcherT> !UnwindSafe for ContainsMatcher<InnerMatcherT>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more