| 19 | |
| 20 | impl Interpreter<'_> { |
| 21 | pub fn run(self) -> Done { |
| 22 | let mut decoder = Decoder::new(); |
| 23 | let mut visitor = debug::Debug(self); |
| 24 | loop { |
| 25 | // Here `decode_one` will call the appropriate `OpVisitor` method on |
| 26 | // `self` via the trait implementation in the module above this. |
| 27 | // That'll return whether we should keep going or exit the loop, |
| 28 | // which is then done here with a conditional `break`. |
| 29 | // |
| 30 | // This will then continue indefinitely until the bytecode says it's |
| 31 | // done. Note that only trusted bytecode is interpreted here. |
| 32 | match decoder.decode_one(&mut visitor) { |
| 33 | Ok(ControlFlow::Continue(())) => {} |
| 34 | Ok(ControlFlow::Break(done)) => break done, |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |