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

Method destroy

crates/wasm/src/js_module.rs:359–366  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

357
358 #[pymethod]
359 fn destroy(&self, vm: &VirtualMachine) -> PyResult<()> {
360 let (closure, _) = self.closure.replace(None).ok_or_else(|| {
361 vm.new_value_error("can't destroy closure has already been destroyed or detached")
362 })?;
363 drop(closure);
364 self.destroyed.set(true);
365 Ok(())
366 }
367 #[pymethod]
368 fn detach(&self, vm: &VirtualMachine) -> PyResult<PyJsValueRef> {
369 let (closure, js_val) = self.closure.replace(None).ok_or_else(|| {

Callers

nothing calls this directly

Calls 3

ok_or_elseMethod · 0.80
replaceMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected