Struct vfs_node::VFSDirectory
source · pub struct VFSDirectory {
pub name: String,
pub children: BTreeMap<String, FileOrDir>,
pub parent: WeakDirRef,
}
Expand description
A struct that represents a node in the VFS
Fields§
§name: String
The name of the directory
children: BTreeMap<String, FileOrDir>
A list of child filesystem nodes
parent: WeakDirRef
A weak reference to the parent directory
Implementations§
Trait Implementations§
source§impl Directory for VFSDirectory
impl Directory for VFSDirectory
source§fn insert(&mut self, node: FileOrDir) -> Result<Option<FileOrDir>, &'static str>
fn insert(&mut self, node: FileOrDir) -> Result<Option<FileOrDir>, &'static str>
Inserts the given new file or directory into this directory.
If an existing node has the same name, that node is replaced and returned. Read more
source§fn get(&self, name: &str) -> Option<FileOrDir>
fn get(&self, name: &str) -> Option<FileOrDir>
Gets either the file or directory in this
Directory
on its name.source§fn remove(&mut self, node: &FileOrDir) -> Option<FileOrDir>
fn remove(&mut self, node: &FileOrDir) -> Option<FileOrDir>
Removes a file or directory from this directory and returns it if found.
Also, the returned node’s parent directory reference is cleared. Read more
source§impl FsNode for VFSDirectory
impl FsNode for VFSDirectory
source§fn get_parent_dir(&self) -> Option<DirRef>
fn get_parent_dir(&self) -> Option<DirRef>
Returns a pointer to the parent if it exists
source§fn set_parent_dir(&mut self, new_parent: WeakDirRef)
fn set_parent_dir(&mut self, new_parent: WeakDirRef)
Sets this node’s parent directory.
This is useful for ensuring correctness when inserting or removing
files or directories from their parent directory.
§fn get_absolute_path(&self) -> String
fn get_absolute_path(&self) -> String
Recursively gets the absolute pathname as a String
Auto Trait Implementations§
impl !RefUnwindSafe for VFSDirectory
impl Send for VFSDirectory
impl Sync for VFSDirectory
impl Unpin for VFSDirectory
impl !UnwindSafe for VFSDirectory
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