Add doc to module helpers

This commit is contained in:
Matthias Beyer 2015-12-29 17:04:24 +01:00
parent 271c91e903
commit e9cee25ac8

View file

@ -1,17 +1,39 @@
/*!
* Utility helpers for modules
*/
pub mod header; pub mod header;
pub mod utils; pub mod utils;
/**
* Helpers for header specs
*/
pub mod spec { pub mod spec {
use storage::file::header::spec::FileHeaderSpec as FHS; use storage::file::header::spec::FileHeaderSpec as FHS;
/**
* Helper to get a spec for a Key-Value for a named text:
*
* { '<name>': "<Text>" }
*/
pub fn named_text(name: &str) -> FHS { pub fn named_text(name: &str) -> FHS {
FHS::Key { name: String::from(name), value_type: Box::new(FHS::Text) } FHS::Key { name: String::from(name), value_type: Box::new(FHS::Text) }
} }
/**
* Helper to get a spec for a Key-Value for a named array:
*
* { '<name>': [ "<Text>", ...] }
*/
pub fn named_text_array(name: &str) -> FHS { pub fn named_text_array(name: &str) -> FHS {
FHS::Key { name: String::from(name), value_type: Box::new(text_array()) } FHS::Key { name: String::from(name), value_type: Box::new(text_array()) }
} }
/**
* Helper to get a spec for Array<Text>:
*
* [ "<Text>", ...]
*/
pub fn text_array() -> FHS { pub fn text_array() -> FHS {
FHS::Array { allowed_types: vec![FHS::Text] } FHS::Array { allowed_types: vec![FHS::Text] }
} }