macro_rules! assert_lt {
($left:expr, $right:expr $(,)?) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description
Asserts that the first expression is less 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_lt!
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_lt!(1, 2);
// With a custom message
assert_lt!(4, 5, "Expecting that {} is less than {}", 4, 5);
ⓘ
assert_lt!(5, 5); // Will panic
assert_lt!(6, 5);
// With a custom message
assert_lt!(6, 5, "Not expecting {} to be less than {}", 6, 5);