mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Add ids() function to VMStore and destroy() method to VirtualMachine
This commit is contained in:
@@ -40,6 +40,12 @@ impl VMStore {
|
||||
cell.borrow_mut().remove(&id);
|
||||
});
|
||||
}
|
||||
|
||||
pub fn ids() -> Vec<JsValue> {
|
||||
STORED_VMS.with(|cell| {
|
||||
cell.borrow().keys().map(|k| k.into()).collect()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = VirtualMachine)]
|
||||
@@ -64,5 +70,9 @@ impl WASMVirtualMachine {
|
||||
}
|
||||
}
|
||||
|
||||
fn destroy(self) {
|
||||
VMStore::destroy(self.id)
|
||||
}
|
||||
|
||||
// TODO: Add actually useful methods
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user