MCPcopy Index your code
hub / github.com/RustPython/RustPython / with_init

Method with_init

crates/vm/src/vm/interpreter.rs:330–343  ·  view source on GitHub ↗

Create with initialize function taking mutable vm reference. Note: This is a legacy API. To add stdlib, use `Interpreter::builder()` instead.

(settings: Settings, init: F)

Source from the content-addressed store, hash-verified

328 ///
329 /// Note: This is a legacy API. To add stdlib, use `Interpreter::builder()` instead.
330 pub fn with_init<F>(settings: Settings, init: F) -> Self
331 where
332 F: FnOnce(&mut VirtualMachine),
333 {
334 let (vm, global_state) = initialize_main_vm(
335 settings,
336 Context::genesis().clone(),
337 Vec::new(), // No module_defs
338 Vec::new(), // No frozen_modules
339 Vec::new(), // No init_hooks
340 init,
341 );
342 Self { global_state, vm }
343 }
344
345 /// Run a function with the main virtual machine and return a PyResult of the result.
346 ///

Callers

nothing calls this directly

Calls 3

initialize_main_vmFunction · 0.85
newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected