pub struct TreeNode {
pub name: String,
pub path: PathBuf,
pub kind: &'static str,
pub size: Option<u64>,
pub link_target: Option<String>,
pub truncated_count: Option<usize>,
pub children: Vec<TreeNode>,
}Expand description
One node in the data-dir tree. Directories have children; files have
a size; symlinks carry the resolved target path so the renderer can
show → /….
Fields§
§name: StringDisplay name — the file/dir basename for everything except the root, which uses the full data_dir path.
path: PathBufAbsolute path to this node.
kind: &'static str"dir", "file", "symlink", or "truncated". The renderer
picks an icon based on this.
size: Option<u64>Size in bytes for files (via lstat, so symlinks report the
link-entry size, not the target’s).
link_target: Option<String>Symlink target as a plain string (not resolved). None for non-symlinks.
truncated_count: Option<usize>For kind == "truncated", the number of children not expanded.
children: Vec<TreeNode>Children of a directory. Empty for files/symlinks.
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn count_nodes(&self) -> usize
pub fn count_nodes(&self) -> usize
Count nodes in the subtree rooted here (including self).
Sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Total file size (symlinks counted by their link-entry size).