pub struct DevNode {
name: String,
file_type: FileType,
file_id: u64,
children: RwLock<BTreeMap<String, Arc<DevNode>>>,
filesystem: RwLock<Option<Weak<dyn FileSystemOperations>>>,
}
Expand description
A node in the DevFS filesystem
Fields§
§name: String
Node name
file_type: FileType
File type
file_id: u64
File ID
children: RwLock<BTreeMap<String, Arc<DevNode>>>
Child nodes (for directories)
filesystem: RwLock<Option<Weak<dyn FileSystemOperations>>>
Reference to filesystem
Implementations§
Source§impl DevNode
impl DevNode
Sourcepub fn new_directory(name: String) -> Self
pub fn new_directory(name: String) -> Self
Create a new directory node
Sourcepub fn new_device_file(name: String, file_type: FileType, file_id: u64) -> Self
pub fn new_device_file(name: String, file_type: FileType, file_id: u64) -> Self
Create a new device file node
Sourcepub fn set_filesystem(&self, fs: Weak<dyn FileSystemOperations>)
pub fn set_filesystem(&self, fs: Weak<dyn FileSystemOperations>)
Set filesystem reference
Sourcepub fn add_child(
&self,
name: String,
child: Arc<DevNode>,
) -> Result<(), FileSystemError>
pub fn add_child( &self, name: String, child: Arc<DevNode>, ) -> Result<(), FileSystemError>
Add a child node
Sourcepub fn clear_children(&self)
pub fn clear_children(&self)
Clear all children (for dynamic updates)
Sourcepub fn readdir(&self) -> Result<Vec<DirectoryEntryInternal>, FileSystemError>
pub fn readdir(&self) -> Result<Vec<DirectoryEntryInternal>, FileSystemError>
Read directory contents
Sourcepub fn open(&self) -> Result<Arc<dyn FileObject>, FileSystemError>
pub fn open(&self) -> Result<Arc<dyn FileObject>, FileSystemError>
Open the node as a file object
Trait Implementations§
Source§impl VfsNode for DevNode
impl VfsNode for DevNode
Source§fn metadata(&self) -> Result<FileMetadata, FileSystemError>
fn metadata(&self) -> Result<FileMetadata, FileSystemError>
Get metadata for this node
Source§fn filesystem(&self) -> Option<Weak<dyn FileSystemOperations>>
fn filesystem(&self) -> Option<Weak<dyn FileSystemOperations>>
Returns a (Weak) reference to the filesystem this node belongs to
Source§fn file_type(&self) -> Result<FileType, FileSystemError>
fn file_type(&self) -> Result<FileType, FileSystemError>
Get the file type of this node
Source§fn is_directory(&self) -> Result<bool, FileSystemError>
fn is_directory(&self) -> Result<bool, FileSystemError>
Returns true if this node is a directory
Source§fn is_symlink(&self) -> Result<bool, FileSystemError>
fn is_symlink(&self) -> Result<bool, FileSystemError>
Returns true if this node is a symbolic link
Source§fn read_link(&self) -> Result<String, FileSystemError>
fn read_link(&self) -> Result<String, FileSystemError>
Read the target of a symbolic link (returns error if not a symlink)
Auto Trait Implementations§
impl !Freeze for DevNode
impl !RefUnwindSafe for DevNode
impl Send for DevNode
impl Sync for DevNode
impl Unpin for DevNode
impl !UnwindSafe for DevNode
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)