assert_len_ne_x

Macro assert_len_ne_x 

Source
macro_rules! assert_len_ne_x {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a length is not equal to an expression.

Pseudocode:
a.len() ≠ b

  • If true, return (a.len(), b).

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

§Examples

use assertables::*;

let a = "x";
let b = 2;
assert_len_ne_x!(a, b);

// This will panic
let a = "x";
let b = 1;
assert_len_ne_x!(a, b);
// assertion failed: `assert_len_ne_x!(a, b)`
// https://docs.rs/assertables/…/assertables/macro.assert_len_ne_x.html
//  a label: `a`,
//  a debug: `\"x\"`,
//  a.len(): `1`",
//  b label: `b`,
//  b debug: `1`

§Module macros