flow_control
Declarative macros for common control-flow use cases such as break, continue, and return.
break_if
Break from a loop if a given predicate evaluates to true.
use break_if;
break_if!;
break_if!;
continue_if
Continue to the next iteration of a loop if a given predicate evaluates to true.
use continue_if;
continue_if!;
continue_if!;
return_if
Return from a function if a given predicate evaluates to true.
use return_if;
return_if!;
return_if!;
Examples
break_if
Predicate only
use break_if;
let mut v = Vecnew;
for outer_n in 1..3
assert_eq!;
Predicate and label
use break_if;
let mut v = Vecnew;
'outer: for outer_n in 1..3
assert_eq!;
continue_if
Predicate only
use continue_if;
let mut v = Vecnew;
for outer_n in 1..3
assert_eq!;
Predicate and label
use continue_if;
let mut v = Vecnew;
'outer: for outer_n in 1..3
assert_eq!;
return_if
Default return
use return_if;
let mut v = Vecnew;
;
assert_eq!;
Return a specified value
use return_if;
let get_value = ;
assert_eq!;