From 3ebe9e6f792a0457c6f3b37b6e9d92c83f8694e2 Mon Sep 17 00:00:00 2001 From: troido Date: Sat, 8 Feb 2020 18:50:58 +0100 Subject: don't rebuild the ground each step --- src/encyclopedia.rs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/encyclopedia.rs') diff --git a/src/encyclopedia.rs b/src/encyclopedia.rs index 19d4297..5cdf90c 100644 --- a/src/encyclopedia.rs +++ b/src/encyclopedia.rs @@ -12,12 +12,6 @@ pub struct Encyclopedia { impl Encyclopedia { - pub fn new() -> Encyclopedia { - Encyclopedia { - items: HashMap::new() - } - } - pub fn from_json(val: Value) -> Result { let mut items = HashMap::new(); for (k, v) in val.as_object().ok_or("encyclopedia not a json object")?.into_iter() { @@ -26,12 +20,6 @@ impl Encyclopedia { Ok(Encyclopedia{items}) } - pub fn add_assemblage(&mut self, name: &str, assemblage: Assemblage) -> Result<(), &'static str> { - //todo: what if name exists - self.items.insert(name.to_string(), assemblage); - Ok(()) - } - pub fn construct(&self, template: &Template) -> Result, &'static str> { let assemblage = self.items.get(&template.name).ok_or("unknown assemblage name")?; assemblage.instantiate(&template.args, &template.kwargs) -- cgit