1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
use std::collections::HashMap; use winstructs::reference::MftReference; #[derive(Hash, Eq, PartialEq, Debug, Clone)] pub struct PathMapping { pub name: String, pub parent: MftReference, } #[derive(Default)] pub struct PathEnumerator { pub mapping: HashMap<MftReference, PathMapping>, } impl PathEnumerator { pub fn new() -> PathEnumerator { PathEnumerator { mapping: HashMap::new(), } } pub fn get_mapping(&self, reference: MftReference) -> Option<PathMapping> { match self.mapping.get(&reference) { Some(value) => Some(value.clone()), None => None, } } pub fn print_mapping(&self) { println!("{:?}", self.mapping); } pub fn contains_mapping(&self, reference: MftReference) -> bool { self.mapping.contains_key(&reference) } pub fn set_mapping(&mut self, reference: MftReference, mapping: PathMapping) { self.mapping.insert(reference, mapping); } }