[−][src]Macro totems::assert_any
Asserts that any item
in a collection
matches a predicate
.
Parameters
&collection
A reference to a collection.predicate
A closure or function that takes anitem
and returns a boolean.description
(optional) A string describing the predicate.
Dependencies
- All content must implement Debug
&collection
must implement IntoIterator.
Example
use totems::assert_any; let vec = vec![1, 3, 5, 7, 9, 11, 13, 15, 17, 19]; assert_any!(&vec, |&x| x > 0, "any > 0");
Example Error Messages
thread 'main' panicked at 'assertion failed: (any element of collection matches predicate)
predicate: any < 0
collection: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
', src/collections.rs:188:9