Break with label


#1

I cannot find in the book ho to break out of a nested loop using a label.

outer:
for x in container_of_containers {
  for y in x {
    if test_y(y) {
      break outer;
    }
  }
}

Is there some rusty way? I feel I am missing something simple about the syntax


#2

Yes, you can do this – it just looks like a lifetime: 'outer: ... break 'outer; ...

It’s at least in the reference here:
https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html#loop-labels


#3