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

Method init

crates/wasm/src/vm_class.rs:111–120  ·  view source on GitHub ↗
(id: String, inject_browser_module: Option<bool>)

Source from the content-addressed store, hash-verified

109#[wasm_bindgen(js_class = vmStore)]
110impl VMStore {
111 pub fn init(id: String, inject_browser_module: Option<bool>) -> WASMVirtualMachine {
112 STORED_VMS.with_borrow_mut(|vms| {
113 if !vms.contains_key(&id) {
114 let stored_vm =
115 StoredVirtualMachine::new(id.clone(), inject_browser_module.unwrap_or(true));
116 vms.insert(id.clone(), Rc::new(stored_vm));
117 }
118 });
119 WASMVirtualMachine { id }
120 }
121
122 pub(crate) fn _get(id: String) -> Option<WASMVirtualMachine> {
123 STORED_VMS.with_borrow(|vms| vms.contains_key(&id).then_some(WASMVirtualMachine { id }))

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
contains_keyMethod · 0.80
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected