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

Method add_to_scope

crates/wasm/src/vm_class.rs:214–219  ·  view source on GitHub ↗
(&self, name: String, value: JsValue)

Source from the content-addressed store, hash-verified

212
213 #[wasm_bindgen(js_name = addToScope)]
214 pub fn add_to_scope(&self, name: String, value: JsValue) -> Result<(), JsValue> {
215 self.with_vm(move |vm, StoredVirtualMachine { scope, .. }| {
216 let value = convert::js_to_py(vm, value);
217 scope.globals.set_item(&name, value, vm).into_js(vm)
218 })?
219 }
220
221 #[wasm_bindgen(js_name = setStdout)]
222 pub fn set_stdout(&self, stdout: JsValue) -> Result<(), JsValue> {

Callers 1

run_pyFunction · 0.80

Calls 4

js_to_pyFunction · 0.85
with_vmMethod · 0.80
into_jsMethod · 0.80
set_itemMethod · 0.45

Tested by

no test coverage detected