Trait VfsNode

Source
pub trait VfsNode:
    Send
    + Sync
    + Any {
    // Required methods
    fn id(&self) -> u64;
    fn filesystem(&self) -> Option<Weak<dyn FileSystemOperations>>;
    fn metadata(&self) -> Result<FileMetadata, FileSystemError>;
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn file_type(&self) -> Result<FileType, FileSystemError> { ... }
    fn is_directory(&self) -> Result<bool, FileSystemError> { ... }
    fn is_symlink(&self) -> Result<bool, FileSystemError> { ... }
    fn read_link(&self) -> Result<String, FileSystemError> { ... }
}
Expand description

VfsNode trait represents the “entity” interface for files and directories

This trait provides only basic APIs for file/directory attributes, type checks, fs reference, and downcasting. All operation APIs (lookup, create, remove, open, etc.) are consolidated in FileSystemOperations for clear separation of concerns.

Required Methods§

Source

fn id(&self) -> u64

Returns the unique identifier in the filesystem

Source

fn filesystem(&self) -> Option<Weak<dyn FileSystemOperations>>

Returns a (Weak) reference to the filesystem this node belongs to

Source

fn metadata(&self) -> Result<FileMetadata, FileSystemError>

Get metadata for this node

Source

fn as_any(&self) -> &dyn Any

Helper for downcasting

Provided Methods§

Source

fn file_type(&self) -> Result<FileType, FileSystemError>

Get the file type of this node

Source

fn is_directory(&self) -> Result<bool, FileSystemError>

Returns true if this node is a directory

Returns true if this node is a symbolic link

Read the target of a symbolic link (returns error if not a symlink)

Trait Implementations§

Source§

impl Debug for dyn VfsNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§