n0_error

Macro ensure

Source
macro_rules! ensure {
    ($predicate:expr, $($tt:tt)*) => { ... };
}
Expand description

Ensures a condition, otherwise returns the error constructed with e from the remaining args.

This macro takes an expression as its first argument. If the expression evaluates to false, the macro expands to returning an error result.

The error will be constructed by passing all remaining arguments to e. See its docs for details on accepted forms.