pub struct DirNode {
pub children: HashMap<String, DirNode>,
pub file_size: u64,
pub file_count: usize,
}Expand description
Intermediate tree node for building the hierarchy from filesystem paths.
Each node represents either a file (leaf with file_size > 0 and no children)
or a directory (with children). Sizes aggregate upward via total_size().
Fields§
§children: HashMap<String, DirNode>§file_size: u64Total size of files directly in this node (leaf files)
file_count: usizeNumber of files directly in this node
Implementations§
Source§impl DirNode
impl DirNode
pub fn new() -> Self
Sourcepub fn insert(&mut self, path_components: &[&str], size: u64)
pub fn insert(&mut self, path_components: &[&str], size: u64)
Insert a file path into the tree, splitting on path separators.
Sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Compute total size of this subtree.
Sourcepub fn total_file_count(&self) -> usize
pub fn total_file_count(&self) -> usize
Total number of files in this subtree.
Sourcepub fn to_echarts(&self, name: &str) -> EChartsNode
pub fn to_echarts(&self, name: &str) -> EChartsNode
Convert to ECharts JSON tree, collapsing single-child directories.
Single-child directory chains are collapsed (e.g., a/b/c becomes
a single node named "a/b/c") to reduce visual clutter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DirNode
impl RefUnwindSafe for DirNode
impl Send for DirNode
impl Sync for DirNode
impl Unpin for DirNode
impl UnsafeUnpin for DirNode
impl UnwindSafe for DirNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more