diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 28 |
1 files changed, 0 insertions, 28 deletions
@@ -15,12 +15,6 @@ use std::io::Read; use std::fs::File; #[derive(Debug, PartialEq)] -pub struct ModelMetadata { - pub name_en: String, - pub description_en: Option<String>, -} - -#[derive(Debug, PartialEq)] pub enum ModelVarType { Independent, Dependent, @@ -42,22 +36,9 @@ pub struct ModelVar { #[derive(Debug, PartialEq)] pub struct ModelEntry { pub ast: modelica_parser::ModelicaModel, - pub metadata: ModelMetadata, pub markdown: String, } -pub fn parse_metadata(raw: String) -> Result<ModelMetadata, String> { - let root = toml::Parser::new(&raw).parse().unwrap(); - let model = root.get("model") - .expect("missing 'model' section") - .as_table() - .unwrap(); - 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()), - }) -} - pub fn load_model_entry(p: &Path) -> Result<ModelEntry, String> { debug!("Attempting to load model from: {:?}", p); @@ -69,14 +50,6 @@ pub fn load_model_entry(p: &Path) -> Result<ModelEntry, String> { try!(modelica_parser::parse_model(&s).map_err(|e| format!("{:?}", e))) }; - let metadata = { - let mut s = String::new(); - try!(File::open(p.join("metadata.toml")) - .and_then(|mut f| f.read_to_string(&mut s)) - .map_err(|e| e.to_string())); - parse_metadata(s).unwrap() - }; - let markdown = { let mut s = String::new(); try!(File::open(p.join("page.md")) @@ -87,7 +60,6 @@ pub fn load_model_entry(p: &Path) -> Result<ModelEntry, String> { Ok(ModelEntry { ast: ast, - metadata: metadata, markdown: markdown, }) } |