Macro assert_iter_le

Source
macro_rules! assert_iter_le {
    ($a_collection:expr, $b_collection:expr $(,)?) => { ... };
    ($a_collection:expr, $b_collection:expr, $($message:tt)+) => { ... };
}
Expand description

Assert an iterable is less than or equal to another.

Pseudocode:
(collection1 into iter) ≤ (collection2 into iter)

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;

let a = [1, 2];
let b = [3, 4];
assert_iter_le!(&a, &b);

// This will panic
let a = [3, 4];
let b = [1, 2];
assert_iter_le!(&a, &b);
// assertion failed: `assert_iter_le!(a_collection, b_collection)`
// https://docs.rs/assertables/…/assertables/macro.assert_iter_le.html
//  a label: `&a`,
//  a debug: `[3, 4]`,
//  b label: `&b`,
//  b debug: `[1, 2]`

This implementation uses ::std::iter::Iterator.

§Module macros