diff options
| author | troido <troido@protonmail.com> | 2020-02-08 18:50:58 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-08 18:50:58 +0100 |
| commit | 3ebe9e6f792a0457c6f3b37b6e9d92c83f8694e2 (patch) | |
| tree | aaa81d23a4816ebecacc64593419d3d811b7283b /src/encyclopedia.rs | |
| parent | 7dfc7956a7c2df9a1df3ea0b32e0c3d2036fa3ce (diff) | |
don't rebuild the ground each step
Diffstat (limited to 'src/encyclopedia.rs')
| -rw-r--r-- | src/encyclopedia.rs | 12 |
1 files changed, 0 insertions, 12 deletions
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<Encyclopedia, &'static str> { 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<Vec<ComponentWrapper>, &'static str> { let assemblage = self.items.get(&template.name).ok_or("unknown assemblage name")?; assemblage.instantiate(&template.args, &template.kwargs) |
