Run a function with the main virtual machine and return a PyResult of the result. To enter vm context multiple times or to avoid buffer/exception management, this function is preferred. `enter` is lightweight and it returns a python object in PyResult. You can stop or continue the execution multiple times by calling `enter`. To finalize the vm once all desired `enter`s are called, calling `final
(&self, f: F)
| 352 | /// |
| 353 | /// See also [`Interpreter::run`] for managed way to run the interpreter. |
| 354 | pub fn enter<F, R>(&self, f: F) -> R |
| 355 | where |
| 356 | F: FnOnce(&VirtualMachine) -> R, |
| 357 | { |
| 358 | thread::enter_vm(&self.vm, || f(&self.vm)) |
| 359 | } |
| 360 | |
| 361 | /// Run [`Interpreter::enter`] and call [`VirtualMachine::expect_pyresult`] for the result. |
| 362 | /// |