pub struct DirectoryLayout {
pub name: String,
pub files: Vec<FileLayout>,
pub subdirs: Vec<DirectoryLayout>,
pub timestamps: Timestamps,
pub attributes: u32,
pub extent: Option<Extent>,
}Expand description
Directory layout (tree of files).
Represents a complete directory tree with pre-calculated extents for all files. Used for metadata-only writing operations.
Fields§
§name: StringDirectory name (empty string for root).
files: Vec<FileLayout>Files in this directory.
subdirs: Vec<DirectoryLayout>Subdirectories.
timestamps: TimestampsDirectory timestamps.
attributes: u32Filesystem-specific attribute flags.
extent: Option<Extent>Extent for the directory entry itself (if applicable).
Implementations§
Source§impl DirectoryLayout
impl DirectoryLayout
Sourcepub fn add_file(&mut self, file: FileLayout)
pub fn add_file(&mut self, file: FileLayout)
Adds a file to this directory.
Sourcepub fn add_subdir(&mut self, subdir: DirectoryLayout)
pub fn add_subdir(&mut self, subdir: DirectoryLayout)
Adds a subdirectory to this directory.
Sourcepub fn with_timestamps(self, timestamps: Timestamps) -> Self
pub fn with_timestamps(self, timestamps: Timestamps) -> Self
Sets the timestamps.
Sourcepub fn with_extent(self, extent: Extent) -> Self
pub fn with_extent(self, extent: Extent) -> Self
Sets the extent for this directory entry.
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Returns the total number of files in this directory (not recursive).
Sourcepub fn subdir_count(&self) -> usize
pub fn subdir_count(&self) -> usize
Returns the total number of subdirectories in this directory (not recursive).
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Returns the total number of entries (files + subdirs).
Sourcepub fn iter_files(&self) -> impl Iterator<Item = (&str, &FileLayout)>
pub fn iter_files(&self) -> impl Iterator<Item = (&str, &FileLayout)>
Returns an iterator over all files (recursive, depth-first).
Sourcepub fn find_file(&self, path: &str) -> Option<&FileLayout>
pub fn find_file(&self, path: &str) -> Option<&FileLayout>
Finds a file by path (e.g., “docs/readme.txt”).
Sourcepub fn find_file_mut(&mut self, path: &str) -> Option<&mut FileLayout>
pub fn find_file_mut(&mut self, path: &str) -> Option<&mut FileLayout>
Finds a mutable file reference by path.
Sourcepub fn get_or_create_dir(&mut self, path: &str) -> &mut DirectoryLayout
pub fn get_or_create_dir(&mut self, path: &str) -> &mut DirectoryLayout
Finds or creates a subdirectory by path.
Sourcepub fn remove_file(&mut self, path: &str) -> Option<FileLayout>
pub fn remove_file(&mut self, path: &str) -> Option<FileLayout>
Removes a file by path. Returns the removed file if found.
Trait Implementations§
Source§impl Clone for DirectoryLayout
impl Clone for DirectoryLayout
Source§fn clone(&self) -> DirectoryLayout
fn clone(&self) -> DirectoryLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more