1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use std::collections::HashMap; use types::*; #[derive(Default)] pub struct Environment { data: HashMap<String, RispType>, } impl Environment { pub fn new() -> Self { Environment { data: HashMap::new() } } pub fn set(&mut self, key: &str, value: RispType) { self.data.insert(key.to_string(), value); } pub fn get(&self, key: &str) -> Option<RispType> { self.data.get(key).cloned() } }