pub struct FileNode {
pub id: NodeId,
pub name: CompactString,
pub kind: NodeKind,
pub size: u64,
pub blocks: u64,
pub timestamps: Timestamps,
pub inode: Option<InodeInfo>,
pub content_hash: Option<ContentHash>,
pub children: Vec<FileNode>,
}Expand description
A single file or directory in the tree.
Fields§
§id: NodeIdUnique identifier for this node.
name: CompactStringFile/directory name (not full path).
kind: NodeKindNode type and associated metadata.
size: u64Size in bytes (aggregate for directories).
blocks: u64Disk blocks actually used.
timestamps: TimestampsFile metadata timestamps.
inode: Option<InodeInfo>Inode info for hardlink detection.
content_hash: Option<ContentHash>Content hash (computed on demand).
children: Vec<FileNode>Children nodes (directories only), sorted by size descending.
Implementations§
Source§impl FileNode
impl FileNode
Sourcepub fn new_file(
id: NodeId,
name: impl Into<CompactString>,
size: u64,
blocks: u64,
timestamps: Timestamps,
executable: bool,
) -> Self
pub fn new_file( id: NodeId, name: impl Into<CompactString>, size: u64, blocks: u64, timestamps: Timestamps, executable: bool, ) -> Self
Create a new file node.
Sourcepub fn new_directory(
id: NodeId,
name: impl Into<CompactString>,
timestamps: Timestamps,
) -> Self
pub fn new_directory( id: NodeId, name: impl Into<CompactString>, timestamps: Timestamps, ) -> Self
Create a new directory node.
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Get the number of direct children.
Sourcepub fn file_count(&self) -> u64
pub fn file_count(&self) -> u64
Get file count for directories, 1 for files.
Sourcepub fn sort_children_by_size(&mut self)
pub fn sort_children_by_size(&mut self)
Sort children by size in descending order.
Sourcepub fn update_counts(&mut self)
pub fn update_counts(&mut self)
Update directory counts based on children.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileNode
impl<'de> Deserialize<'de> for FileNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FileNode
impl RefUnwindSafe for FileNode
impl Send for FileNode
impl Sync for FileNode
impl Unpin for FileNode
impl UnwindSafe for FileNode
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