Skip to main content

insert_path_iterative

Function insert_path_iterative 

Source
pub fn insert_path_iterative(
    tree: &mut BTreeMap<String, Box<Tree>>,
    parts: &[&str],
)
Expand description

Inserts a path (as dot-separated parts) into the tree structure (ITERATIVE VERSION - Simple)

This version iterates through path parts without recursion, using only heap-allocated mutable references. No explicit stack data structure needed.

§Arguments

  • tree - The tree node to insert into
  • parts - Slice of path parts to insert

§Example

use dir_path_2_tree::*;
let mut tree = Tree::default();
insert_path_iterative(&mut tree.0, &["a", "b", "c"]);