pub trait FileSystem: Send + Sync {
// Required methods
fn can_handle(&self, path: &str) -> bool;
fn open_read(&self, path: &str) -> Result<Box<dyn FileRead>>;
fn open_write(&self, path: &str) -> Result<Box<dyn FileWrite>>;
fn exists(&self, path: &str) -> bool;
fn remove(&self, path: &str) -> Result<()>;
fn create_dir_all(&self, path: &str) -> Result<()>;
}Expand description
A generic file system interface.
Required Methods§
Sourcefn can_handle(&self, path: &str) -> bool
fn can_handle(&self, path: &str) -> bool
Check if this file system can handle the given path/URL.
Sourcefn open_write(&self, path: &str) -> Result<Box<dyn FileWrite>>
fn open_write(&self, path: &str) -> Result<Box<dyn FileWrite>>
Open a file for writing (creates or truncates).
Sourcefn create_dir_all(&self, path: &str) -> Result<()>
fn create_dir_all(&self, path: &str) -> Result<()>
Create a directory and all parents.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".