pub fn require(condition: bool) -> Option<()>
Expand description
Returns Some(())
if the condition is true, otherwise None
.
Useful in functions returning None
on some condition:
require(condition)?;
And for functions returning Err
on some condition:
require(condition).ok_or_else(|| create_err())?;