Skip to main content

assert_contains

Function assert_contains 

Source
pub fn assert_contains<H, N>(needle: N, haystack: H)
where H: Container + Debug, N: Borrow<H::Item>, H::Item: Debug,
Expand description

Assert that a haystack contains the given needle.

Uses the Container abstraction so it works with slices, vectors, sets, maps (by key), strings, and ranges. The error message includes both the container and the item for quick debugging.

ยงPanics

Panics if haystack.contains(needle) returns false.