Skip to main content

pakem/core/
container.rs

1use std::any::Any;
2use std::collections::HashMap;
3
4pub struct Container {
5    bindings: HashMap<String, Box<dyn Any>>,
6}
7
8impl Container {
9    pub fn new() -> Self {
10        Self {
11            bindings: HashMap::new(),
12        }
13    }
14
15    pub fn bind<T: 'static>(&mut self, key: String, value: T) {
16        self.bindings.insert(key, Box::new(value));
17    }
18}