From 4bdf3106e13576e1b46a1d5e2e841ebc61045ee1 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 25 Dec 2016 23:36:35 -0800 Subject: remove variables from metadata files Plan here is to make these examples only. --- src/lib.rs | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index e20c8fb..07bc0b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,6 @@ use std::fs::File; pub struct ModelMetadata { pub name_en: String, pub description_en: Option, - pub vars: Vec, } #[derive(Debug, PartialEq)] @@ -53,34 +52,9 @@ pub fn parse_metadata(raw: String) -> Result { .expect("missing 'model' section") .as_table() .unwrap(); - let variables = root.get("variables") - .expect("missing 'variables' section") - .as_table() - .unwrap(); - let mut vars = vec![]; - for (slug, info) in variables { - let info = info.as_table().unwrap(); - let vtype = match info.get("type").unwrap().as_str().unwrap() { - "independent" => ModelVarType::Independent, - "dependent" => ModelVarType::Dependent, - "constant" => ModelVarType::Constant, - "time" => ModelVarType::Time, - "state" => ModelVarType::State, - "parameter" => ModelVarType::Parameter, - other => return Err(format!("Unknown variable type: {}", other)), - }; - vars.push(ModelVar { - slug: slug.to_string(), - name_en: info.get("name-en").map(|x| x.as_str().unwrap().to_string()), - vtype: vtype, - latex: info.get("latex").map(|x| x.as_str().unwrap().to_string()), - units_si: info.get("units-si").map(|x| x.as_str().unwrap().to_string()), - }); - } Ok(ModelMetadata { name_en: model.get("name-en").unwrap().as_str().unwrap().to_string(), description_en: model.get("description-en").map(|x| x.as_str().unwrap().to_string()), - vars: vars, }) } -- cgit v1.2.3