]> git.proxmox.com Git - proxmox-backup.git/blob - src/static_map.rs
parse_arguments: work with utf8 bytes and reduce indentation
[proxmox-backup.git] / src / static_map.rs
1 #[derive(Debug)]
2 pub struct StaticMap<'a, K, V> {
3 pub entries: &'a [(K,V)],
4 }
5
6 impl<'a, K: Eq, V> StaticMap<'a, K, V> {
7
8 #[inline]
9 pub fn len(&self) -> usize {
10 self.entries.len()
11 }
12
13 pub fn get(&self, key: &K) -> Option<&V> {
14 for (ref k, ref v) in self.entries {
15 if k == key { return Some(v) }
16 }
17 None
18 }
19 }