Build a tree structure from flat paths. Organizes items into a hierarchical structure by parent-child relationships. # Arguments `items` - Flat list of tree items # Returns A map from parent path to child items. # Example ```rust use atomic_core::output::repo::{build_tree_hierarchy, TreeItem}; use atomic_core::types::{Inode, Position}; let items = vec![ TreeItem::file("src/main.rs", Inode:
(items: &[TreeItem])
| 946 | /// assert!(hierarchy.get("src").is_some()); |
| 947 | /// ``` |
| 948 | pub fn build_tree_hierarchy(items: &[TreeItem]) -> HashMap<String, Vec<&TreeItem>> { |
| 949 | let mut hierarchy: HashMap<String, Vec<&TreeItem>> = HashMap::new(); |
| 950 | |
| 951 | for item in items { |
| 952 | let parent = item.parent_path().to_string(); |
| 953 | hierarchy.entry(parent).or_default().push(item); |
| 954 | } |
| 955 | |
| 956 | hierarchy |
| 957 | } |
| 958 | |
| 959 | // ============================================================================ |
| 960 | // TESTS |