Expand description
Declarative macros for common control-flow use cases such as break
, continue
, and return
.
break
from a loop if a given predicate evaluates to true
.
Supports optionally providing a loop label to specify the loop from which to break
.
use flow_control::break_if;
break_if!(predicate);
break_if!(predicate, label);
continue
to the next iteration of a loop if a given predicate evaluates to true
.
Supports optionally providing a loop label to specify the loop in which to continue
.
use flow_control::continue_if;
continue_if!(predicate);
continue_if!(predicate, label);
return
from a function if a given predicate evaluates to true
.
Supports optionally providing a value to return
.
use flow_control::return_if;
return_if!(predicate);
return_if!(predicate, value);