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

Method inject_sso_instance

aiscript-vm/src/vm/extra.rs:35–54  ·  view source on GitHub ↗
(&mut self, fields: HashMap<K, serde_json::Value>)

Source from the content-addressed store, hash-verified

33 }
34
35 pub fn inject_sso_instance<K>(&mut self, fields: HashMap<K, serde_json::Value>)
36 where
37 K: AsRef<str> + Eq,
38 {
39 self.arena.mutate_root(|mc, state| {
40 let ctx = state.get_context();
41 let name = state.intern_static("sso");
42 let class = crate::builtins::sso::create_sso_provider_class(ctx);
43 let mut instance = Instance::new(class);
44 for (key, value) in fields {
45 instance.fields.insert(
46 state.intern(key.as_ref().as_bytes()),
47 Value::from_serde_value(ctx, &value),
48 );
49 }
50 state
51 .globals
52 .insert(name, Gc::new(mc, RefLock::new(instance)).into());
53 });
54 }
55
56 pub fn inject_variables(&mut self, variables: HashMap<String, serde_json::Value>) {
57 self.arena.mutate_root(|_mc, state| {

Callers 1

pollMethod · 0.80

Calls 7

mutate_rootMethod · 0.80
get_contextMethod · 0.80
as_bytesMethod · 0.80
intern_staticMethod · 0.45
internMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected