[−][src]Macro totems::assert_any
Asserts that any item in a collection matches a predicate.
Parameters
&collectionA reference to a collection.predicateA closure or function that takes anitemand returns a boolean.description(optional) A string describing the predicate.
Dependencies
collectionmust implement Iterator.&collectionmust 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