Add function to build header content

This commit is contained in:
Matthias Beyer 2015-11-08 17:11:48 +01:00
parent 9f29f0e1b7
commit cd72295c1a

View file

@ -1,4 +1,5 @@
use storage::file::FileHeaderSpec as FHS;
use storage::file::FileHeaderData as FHD;
pub fn get_spec() -> FHS {
FHS::Map { keys: vec![ url_key(), tags_key() ] }
@ -16,3 +17,19 @@ fn text_array() -> FHS {
FHS::Array { allowed_types: vec![FHS::Text] }
}
pub fn build_header(url: &String, tags: &Vec<String>) -> FHD {
FHD::Map {
keys: vec![
FHD::Key {
name: "URL",
value: Box::new(FHD::Text(url.clone()))
},
FHD::Key {
name: "TAGS",
value: Box::new(FHD::Text(tags.connect(",")))
}
]
}
}