Function xpct::contain_element

source ·
pub fn contain_element<'a, T, Actual>(element: T) -> Matcher<'a, Actual, Actual>where
    T: Debug + Clone + 'a,
    Actual: Debug + Contains<T> + 'a,
Expand description

Succeeds when the actual value contains the given element.

You can use this matcher for your own types by implementing Contains on them.

Examples

use xpct::{expect, contain_element};

expect!("foo").to(contain_element('f'));
expect!(["foo", "bar"]).to(contain_element("foo"));