macro_rules! assert_le {
($left:expr, $right:expr $(,)?) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description
Asserts that the first expression is less or equal than the second.
Requires that both expressions be comparable with <=
.
§Uses
Assertions are always checked in both debug and release builds, and cannot be disabled.
See debug_assert_le!
for assertions that are not enabled in release builds by default.
§Custom messages
This macro has a second form, where a custom panic message can be provided with or without
arguments for formatting. See std::fmt
for syntax for this form.
§Examples
assert_le!(1, 2);
// With a custom message
assert_le!(5, 5, "Expecting that {} is less or equal than {}", 5, 5);
ⓘ
assert_le!(6, 5); // Will panic
// With a custom message
assert_le!(6, 5, "Not expecting {} to be less or equal than {}", 6, 5);