macro_rules! require_or_err {
($condition:expr, $msg:expr) => { ... };
}
Expand description
require_or_err
is a macro that checks if a given condition is met.
If the condition is not met, the macro will return an error of type PreconditionFailedError
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 included in thePreconditionFailedError
if the precondition is not met.
§Errors
The macro returns an error of type PreconditionFailedError
if the precondition $condition
is not met, with an error message of the form: “Precondition failed: $msg”.