Hi!
I often find myself writing this code of loop:
for item in items {
let mut skip_item = false;
for predicate in exclusion_predicates {
if predicate(item) {
skip_item = true;
break;
}
}
if skip_item {
continue;
}
// do some stuff
}
What I'd love to write is something like:
for item in items {
for predicate in exclusion_predicates {
if predicate(item) {
continue $parent;
}
}
// do some stuff
}
Is there such a syntax, or an equivalent mechanism in Rust to avoid writing the large snippet I wrote first?
Note that the // do some stuff
is a large portion of code which I'd like to not put behind an if !skip_item {
.
Thanks in advance for your help