aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-29 17:15:24 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-29 17:15:24 -0700
commitcc1f85be5b6780a0bee9f6620946c4bd057b1b8b (patch)
tree295a9e5918f8b07dae956ff9d0d9f727ee057436 /src
parent6915fb25b46cb9d7356caec384ab824ea78c5e4c (diff)
downloadmodelthing-cc1f85be5b6780a0bee9f6620946c4bd057b1b8b.tar.gz
modelthing-cc1f85be5b6780a0bee9f6620946c4bd057b1b8b.zip
make library routines public
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 392f373..a76fc2d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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())