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

Execute if the condition is true, otherwise return

Examples

use what_i_want::*;

fn login(username: String) -> bool {
    require!(username == "admin", false);
}

fn login2(username: String) {
    require!(username == "admin");
}