pub struct Callback { items: Vec } impl Callback { pub fn new() -> Callback { Callback { items: Vec::new() } } pub fn register(&mut self, f: &fn(A)) { self.items.push(*f) } pub fn fire(&self, v: &A) { for _ in self.items.iter().map(|&c| c(v.clone())) {} } }