Macro assertables::assert_set_eq
source · [−]macro_rules! assert_set_eq {
($left:expr, $right:expr $(,)?) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}Expand description
Assert a set is equal to another.
-
When true, return
Ok(()). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
Examples
let a = [1, 2];
let b = [2, 1];
assert_set_eq!(&a, &b);
//-> ()
let a = [1, 2];
let b = [3, 4];
assert_set_eq!(&a, &b);
//-> panic!
// assertion failed: `assert_set_eq!(left, right)`
// left: `[1, 2]`,
// right: `[3, 4]`This macro has a second form where a custom message can be provided.
This implementation uses [HashSet] to count items.