Macro assert_le

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

Assert an expression is less than or equal to another.

Pseudocode:
a ≤ 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 = 2;
assert_le!(a, b);

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

§Module macros