aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs26
1 files changed, 0 insertions, 26 deletions
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<String>,
- pub vars: Vec<ModelVar>,
}
#[derive(Debug, PartialEq)]
@@ -53,34 +52,9 @@ pub fn parse_metadata(raw: String) -> Result<ModelMetadata, String> {
.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,
})
}