Macro require

Source
macro_rules! require {
    ($condition:expr, $msg:expr) => { ... };
}
Expand description

require is a macro that checks if a given condition is met. If the condition is not met, the macro will cause the program to panic with a specified message.

§Arguments

  • $condition: An expression that should evaluate to a boolean. This is the precondition that needs to be checked.
  • $msg: A message that will be printed if the precondition is not met.

§Panics

The macro panics if the precondition $condition is not met, with a panic message of the form: “Precondition failed: $msg”.