diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -11,7 +11,7 @@ use std::io::Read; use std::fs::File; #[derive(Debug, PartialEq)] -struct ModelMetadata { +pub struct ModelMetadata { slug: String, name_en: String, description_en: Option<String>, @@ -19,14 +19,14 @@ struct ModelMetadata { } #[derive(Debug, PartialEq)] -enum ModelVarType { +pub enum ModelVarType { Independent, Dependent, Constant, } #[derive(Debug, PartialEq)] -struct ModelVar { +pub struct ModelVar { slug: String, name_en: String, vtype: Option<ModelVarType>, @@ -35,14 +35,14 @@ struct ModelVar { } #[derive(Debug, PartialEq)] -struct ModelEntry { +pub struct ModelEntry { ast: modelica_ast::ModelicaModel, metadata: ModelMetadata, markdown: String, } // TODO: this -fn parse_metadata(s: String) -> Result<ModelMetadata,String> { +pub fn parse_metadata(s: String) -> Result<ModelMetadata,String> { Ok(ModelMetadata { slug: "dummy".to_string(), name_en: "Bogus Dummy Model".to_string(), @@ -51,7 +51,7 @@ fn parse_metadata(s: String) -> Result<ModelMetadata,String> { }) } -fn load_model_entry(p: &Path) -> Result<ModelEntry,String> { +pub fn load_model_entry(p: &Path) -> Result<ModelEntry,String> { debug!("Attempting to load model from: {:?}", p); let ast = { @@ -80,7 +80,7 @@ fn load_model_entry(p: &Path) -> Result<ModelEntry,String> { } // TODO: have this check for model.modelica etc -fn search_models(p: &Path) -> Vec<String> { +pub fn search_models(p: &Path) -> Vec<String> { if fs::metadata(p).unwrap().is_dir() { fs::read_dir(p).unwrap() .map(|x| x.unwrap()) |