[−][src]Macro totems::assert_all
Asserts that all items in a collection match 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_all; let vec = vec![1, 3, 5, 7, 9, 11, 13, 15, 17, 19]; assert_all!(&vec, |&x| x > 0, "all > 0");
Example Error Messages
thread 'main' panicked at 'assertion failed: (all elements of collection match predicate)
predicate: all < 0
collection: [-1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
', src/collections.rs:165:9