aboutsummaryrefslogtreecommitdiffstats
path: root/sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs')
-rw-r--r--sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs38
1 files changed, 8 insertions, 30 deletions
diff --git a/sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs b/sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs
index 44adc483..35e6d91d 100644
--- a/sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs
+++ b/sys/nixpkgs/pkgs/lf-make-map/src/mapping/map_tree/mod.rs
@@ -9,6 +9,7 @@ use super::MapKey;
pub mod display;
pub mod iterator;
+pub mod lf_mapping;
/// A prefix tree
#[derive(Debug)]
@@ -38,22 +39,8 @@ impl MappingTree {
&self.root
}
- pub fn iter(&self) -> MappingTreeIterator {
- MappingTreeIterator::new(&self)
- }
-
- /// Returns the node at the key, otherwise None
- pub fn get(&self, key: &[MapKey]) -> Option<&Node> {
- let mut current_node = &self.root;
- for ch in key.iter() {
- if let NodeValue::Parent { children } = &current_node.value {
- current_node = children.get(&ch)?
- } else {
- return None;
- }
- }
-
- Some(current_node)
+ pub fn iter(&self, ignore_extendable: bool) -> MappingTreeIterator {
+ MappingTreeIterator::new(&self, ignore_extendable)
}
/// Returns the node at the key, otherwise None. The node can be changed
@@ -126,7 +113,11 @@ impl MappingTree {
}
));
- let child_value = if let NodeValue::Child { path, extandable } = child_value {
+ let child_value = if let NodeValue::Child {
+ path,
+ extandable: _,
+ } = child_value
+ {
NodeValue::Child {
path,
extandable: false,
@@ -147,18 +138,6 @@ impl MappingTree {
Ok(())
}
- pub fn replace_node(&mut self, key: &[MapKey], node: Node) -> Node {
- let parent = self.get_mut(&key[..key.len() - 1]).expect("Must be some");
-
- if let NodeValue::Parent { children } = &mut parent.value {
- children
- .insert(key[key.len() - 1].clone(), node)
- .expect("This must exist, otherwise insert would have been used")
- } else {
- unreachable!("All parent nodes should be parent nodes");
- }
- }
-
pub fn insert_node(&mut self, key: &[MapKey], node: Node) -> Result<()> {
let (_node, found_key) = self.try_get(key).clone();
@@ -348,7 +327,6 @@ Please rename the paths to fix this.
foreign_key[0].part_path,
);
}
- assert_eq!(our_key.len(), foreign_key.len());
debug!(
"Found a better one: '{}' ('{}') and '{}' ('{}')",