1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::collections::{BTreeMap};
use crate::imp::structs::metadata::Metadata;
#[derive(Debug)]
pub struct ArchiveData{
meta : Metadata,
file_data : BTreeMap<String, String>
}
impl ArchiveData{
pub(crate) fn new(meta : Metadata, file_data : BTreeMap<String, String>) -> Self{ Self{ meta, file_data } }
pub fn meta(&self) -> &Metadata{ &self.meta }
pub fn get_data(&self, file_stem : &str) -> Option<&str>{
self.file_data.get(file_stem).map(|v| v.as_str())
}
pub fn iter(&self) -> impl Iterator<Item=(&str, &str)>{
self.file_data.iter().map(|(key,val)| (key.as_str(), val.as_str()))
}
}