diff --git a/src/module/helpers/header/tags.rs b/src/module/helpers/header/tags.rs index f9c22c33..970a07a5 100644 --- a/src/module/helpers/header/tags.rs +++ b/src/module/helpers/header/tags.rs @@ -4,17 +4,14 @@ pub mod spec { use storage::file::FileHeaderSpec as FHS; + use module::helpers::spec::{named_text, named_text_array}; pub fn url_key() -> FHS { - FHS::Key { name: String::from("URL"), value_type: Box::new(FHS::Text) } + named_text("URL") } pub fn tags_key() -> FHS { - FHS::Key { name: String::from("TAGS"), value_type: Box::new(text_array()) } - } - - pub fn text_array() -> FHS { - FHS::Array { allowed_types: vec![FHS::Text] } + named_text_array("TAGS") } } diff --git a/src/module/helpers/mod.rs b/src/module/helpers/mod.rs index 9ed1a0a2..e06a668b 100644 --- a/src/module/helpers/mod.rs +++ b/src/module/helpers/mod.rs @@ -1,2 +1,19 @@ pub mod header; pub mod utils; + +pub mod spec { + use storage::file::FileHeaderSpec as FHS; + + pub fn named_text(name: &str) -> FHS { + FHS::Key { name: String::from(name), value_type: Box::new(FHS::Text) } + } + + pub fn named_text_array(name: &str) -> FHS { + FHS::Key { name: String::from(name), value_type: Box::new(text_array()) } + } + + pub fn text_array() -> FHS { + FHS::Array { allowed_types: vec![FHS::Text] } + } + +}