From e9cee25ac81571b5501e0d4ed2d5424fa82f29e6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 29 Dec 2015 17:04:24 +0100 Subject: [PATCH] Add doc to module helpers --- src/module/helpers/mod.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/module/helpers/mod.rs b/src/module/helpers/mod.rs index 8b501b4a..f260114b 100644 --- a/src/module/helpers/mod.rs +++ b/src/module/helpers/mod.rs @@ -1,17 +1,39 @@ +/*! + * Utility helpers for modules + */ + pub mod header; pub mod utils; +/** + * Helpers for header specs + */ pub mod spec { use storage::file::header::spec::FileHeaderSpec as FHS; + /** + * Helper to get a spec for a Key-Value for a named text: + * + * { '': "" } + */ pub fn named_text(name: &str) -> FHS { 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: + * + * { '': [ "", ...] } + */ pub fn named_text_array(name: &str) -> FHS { FHS::Key { name: String::from(name), value_type: Box::new(text_array()) } } + /** + * Helper to get a spec for Array: + * + * [ "", ...] + */ pub fn text_array() -> FHS { FHS::Array { allowed_types: vec![FHS::Text] } }