diff options
author | matthew seyer <matthew.seyer@gmail.com> | 2017-05-19 08:05:40 +0300 |
---|---|---|
committer | matthew seyer <matthew.seyer@gmail.com> | 2017-05-19 08:05:40 +0300 |
commit | 643c47b3c33e3e9a83eb3c5e3bc793321b2eb463 (patch) | |
tree | a2b972389b7121afc6d2eac1055ee561c1809ea2 /src/enumerator.rs | |
parent | 129b129279c50125f20d2cda276bcb7b5b24b1c7 (diff) |
Added fullname enumeration
Diffstat (limited to 'src/enumerator.rs')
-rw-r--r-- | src/enumerator.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/enumerator.rs b/src/enumerator.rs new file mode 100644 index 0000000..70c4403 --- /dev/null +++ b/src/enumerator.rs @@ -0,0 +1,44 @@ +use std::collections::HashMap; +use rwinstructs::reference::{MftReference}; + +#[derive(Hash, Eq, PartialEq, Debug, Clone)] +pub struct PathMapping { + pub name: String, + pub parent: MftReference, +} + +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 + ); + } +} |