Skip to main content

spreadsheet_ods/io/
mod.rs

1use crate::HashMap;
2use get_size2::GetSize;
3use std::borrow::Cow;
4
5pub(crate) mod format;
6pub(crate) mod parse;
7pub(crate) mod read;
8pub(crate) mod write;
9
10mod xmlwriter;
11
12#[derive(Clone, Debug)]
13pub(crate) struct NamespaceMap {
14    map: HashMap<Cow<'static, str>, Cow<'static, str>>,
15}
16
17impl GetSize for NamespaceMap {}
18
19impl NamespaceMap {
20    pub(crate) fn new() -> Self {
21        Self {
22            map: Default::default(),
23        }
24    }
25
26    pub(crate) fn insert(&mut self, k: String, v: String) {
27        self.map.insert(Cow::Owned(k), Cow::Owned(v));
28    }
29
30    pub(crate) fn insert_str(&mut self, k: &'static str, v: &'static str) {
31        self.map.insert(Cow::Borrowed(k), Cow::Borrowed(v));
32    }
33
34    pub(crate) fn entries(&self) -> impl Iterator<Item = (&Cow<'static, str>, &Cow<'static, str>)> {
35        self.map.iter()
36    }
37}