MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / inject_variables

Method inject_variables

aiscript-vm/src/vm/extra.rs:56–66  ·  view source on GitHub ↗
(&mut self, variables: HashMap<String, serde_json::Value>)

Source from the content-addressed store, hash-verified

54 }
55
56 pub fn inject_variables(&mut self, variables: HashMap<String, serde_json::Value>) {
57 self.arena.mutate_root(|_mc, state| {
58 let ctx = state.get_context();
59 for (key, value) in variables {
60 let name = state.intern(key.as_bytes());
61 state
62 .globals
63 .insert(name, Value::from_serde_value(ctx, &value));
64 }
65 });
66 }
67
68 pub fn inject_object<K>(&mut self, name: &'static str, fields: HashMap<K, serde_json::Value>)
69 where

Callers 1

test_inject_variablesFunction · 0.80

Calls 4

mutate_rootMethod · 0.80
get_contextMethod · 0.80
as_bytesMethod · 0.80
internMethod · 0.45

Tested by 1

test_inject_variablesFunction · 0.64