diff options
| author | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
| commit | c846e929a88837094d7a5383a306df1fec56c333 (patch) | |
| tree | 48ab058d58c090ff00199af6b3eef7d64c7c2c95 /src/encyclopedia.rs | |
| parent | b80036ef629e0803f3a70059a8fa12d1a2ae3b2d (diff) | |
more specific types!
Diffstat (limited to 'src/encyclopedia.rs')
| -rw-r--r-- | src/encyclopedia.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/encyclopedia.rs b/src/encyclopedia.rs index a7bb5b6..7b40373 100644 --- a/src/encyclopedia.rs +++ b/src/encyclopedia.rs @@ -4,12 +4,13 @@ use serde_json::Value; use crate::{ assemblage::Assemblage, componentwrapper::PreEntity, - Template + Template, + template::EntityType }; #[derive(Default, Clone)] pub struct Encyclopedia { - items: HashMap<String, Assemblage> + items: HashMap<EntityType, Assemblage> } impl Encyclopedia { @@ -17,7 +18,7 @@ impl Encyclopedia { 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() { - items.insert(k.clone(), Assemblage::from_json(v)?); + items.insert(EntityType(k.clone()), Assemblage::from_json(v)?); } Ok(Encyclopedia{items}) } |
