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])
| 936 | /// assert!(hierarchy.get("src").is_some()); |
| 937 | /// ``` |
| 938 | pub fn build_tree_hierarchy(items: &[TreeItem]) -> HashMap<String, Vec<&TreeItem>> { |
| 939 | let mut hierarchy: HashMap<String, Vec<&TreeItem>> = HashMap::new(); |
| 940 | |
| 941 | for item in items { |
| 942 | let parent = item.parent_path().to_string(); |
| 943 | hierarchy.entry(parent).or_default().push(item); |
| 944 | } |
| 945 | |
| 946 | hierarchy |
| 947 | } |
| 948 | |
| 949 | // ============================================================================ |
| 950 | // TESTS |