pub trait VirtualFileSystem: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn open_file(&self, path: &str) -> Result<Arc<Mutex<dyn File>>, FileError>;
fn stat_path(&self, path: &str) -> Result<FileMetadata, FileError>;
fn readdir_path(&self, path: &str) -> Result<Vec<String>, FileError>;
// Provided methods
fn create_file(
&self,
_path: &str,
) -> Result<Arc<Mutex<dyn File>>, FileError> { ... }
fn create_dir(&self, _path: &str) -> Result<(), FileError> { ... }
fn remove_file(&self, _path: &str) -> Result<(), FileError> { ... }
}Expand description
Filesystem interface used by the VFS mount table for pseudo filesystems.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Human-readable filesystem name such as procfs, sysfs, or devtmpfs.
Sourcefn open_file(&self, path: &str) -> Result<Arc<Mutex<dyn File>>, FileError>
fn open_file(&self, path: &str) -> Result<Arc<Mutex<dyn File>>, FileError>
Open a file path relative to this virtual filesystem’s mount root.
Provided Methods§
Sourcefn create_file(&self, _path: &str) -> Result<Arc<Mutex<dyn File>>, FileError>
fn create_file(&self, _path: &str) -> Result<Arc<Mutex<dyn File>>, FileError>
Virtual filesystems are read-mostly by default.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".