macro_rules! assert_gt {
($left:expr, $right:expr,) => { ... };
($left:expr, $right:expr) => { ... };
($left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description
Asserts that first expression is greater 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_gt
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_gt!(2, 1);
// With custom messages
assert_gt!(2, 1, "Expecting that {} is greater or equal than {}", 2, 1);
ⓘ
assert_gt!(5, 5); // Will panic
// With custom messages
assert_gt!(5, 6, "Not expecting {} to be greater than {}", 5, 6);