claims

Macro assert_ge

Source
macro_rules! assert_ge {
    ($left:expr, $right:expr $(,)?) => { ... };
    ($left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description

Asserts that the first expression is greater than or equal to 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_ge! 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_ge!(2, 1);

// With a custom message.
assert_ge!(2, 1, "Expecting that {} is greater or equal than {}", 2, 1);
assert_ge!(5, 5, "Expecting that both arguments are equal");
assert_ge!(5, 6);  // Will panic