ralik/context/
functions.rs1use super::{Context, Function};
2
3impl Context {
4 pub fn get_function(&self, key: &str) -> Option<Function> {
5 self.0.functions.read().unwrap().get(key).cloned()
6 }
7
8 pub fn insert_function(&self, key: impl Into<String>, value: Function) -> Option<Function> {
9 self.0.functions.write().unwrap().insert(key.into(), value)
10 }
11
12 pub fn remove_function(&self, key: &str) -> Option<(String, Function)> {
13 self.0.functions.write().unwrap().remove_entry(key)
14 }
15}