Macro failure::ensure[][src]

macro_rules! ensure {
    ($cond:expr) => { ... };
    ($cond:expr, $e:expr) => { ... };
    ($cond:expr, $fmt:expr, $($arg:tt)*) => { ... };
}

Exits a function early with an Error if the condition is not satisfied.

Similar to assert!, ensure! takes a condition and exits the function if the condition fails. Unlike assert!, ensure! returns an Error, it does not panic.