macro_rules! assert_len_eq { ($a:expr, $b:expr $(,)?) => { ... }; ($a:expr, $b:expr, $($message:tt)+) => { ... }; }
Expand description
Assert a length is equal to another length.
Pseudocode:
a.len() = b.len()
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a = "x";
let b = "x";
assert_len_eq!(a, b);
let a = "x";
let b = "xx";
assert_len_eq!(a, b);
// assertion failed: `assert_len_eq!(a, b)`
// https://docs.rs/assertables/8.14.0/assertables/macro.assert_len_eq.html
// a label: `a`,
// a debug: `\"x\"`,
// a.len(): `1`",
// b label: `b`,
// b debug: `\"xx\"`,
// b.len(): `2`"