macro_rules! assert_infix {
($a:tt $infix:tt $b:tt) => { ... };
($a:tt $infix:tt $b:tt, $($message:tt)+) => { ... };
}
Expand description
Assert a infix operator, such as assert_infix!(a == b).
Pseudocode:
a infix b
-
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;
let b = 1;
assert_infix!(a == b);
// This will panic
let a = 1;
let b = 2;
assert_infix!(a == b);
// assertion failed: `assert_infix!(a == b)`
// https://docs.rs/assertables/…/assertables/macro.assert_infix.html
// a label: `a`,
// a debug: `1`,
// b label: `b`,
// b debug: `2`
§Infix operators
For values:
==
equal!=
not equal<
less than<=
less than or equal to>
greater than>=
greater than or equal to
For booleans:
^
logical XOR!
logical NOT&
logical AND|
logical OR&&
logical lazy AND||
logical lazy OR