(&mut self, variables: HashMap<String, serde_json::Value>)
| 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 |