use comm::Message; use std::collections::HashMap; pub struct Store { data: HashMap } impl Store { pub fn new() -> Store { Store { data: HashMap::new() } } pub fn save(&mut self, msg: Message) { self.data.insert(msg.kind, msg.text); } pub fn get(&self, kind: &str) -> &str { match self.data.get(kind) { Some(res) => res, None => "" } } }