use std::collections::BTreeMap;
use ring::digest;
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct MetaData {
pub tags: BTreeMap<String, String>,
}
impl MetaData {
pub fn new() -> Self {
MetaData {
tags: BTreeMap::new(),
}
}
pub fn with_tags(tags: BTreeMap<String, String>) -> Self {
Self { tags }
}
pub(crate) fn hash_into(&self, ctx: &mut digest::Context) {
for (tag, value) in &self.tags {
ctx.update(tag.as_bytes());
ctx.update(b":");
ctx.update(value.as_bytes());
}
}
}