(wasm_vm: &WASMVirtualMachine)
| 91 | .expect("VirtualMachine inside of WASM crate should have wasm_id set") |
| 92 | } |
| 93 | pub(crate) fn stored_vm_from_wasm(wasm_vm: &WASMVirtualMachine) -> Rc<StoredVirtualMachine> { |
| 94 | STORED_VMS.with_borrow(|vms| { |
| 95 | vms.get(&wasm_vm.id) |
| 96 | .expect("VirtualMachine is not valid") |
| 97 | .clone() |
| 98 | }) |
| 99 | } |
| 100 | pub(crate) fn weak_vm(vm: &VirtualMachine) -> Weak<StoredVirtualMachine> { |
| 101 | let id = get_vm_id(vm); |
| 102 | STORED_VMS.with_borrow(|vms| Rc::downgrade(vms.get(id).expect("VirtualMachine is not valid"))) |