pub trait Fs: Send + Sync {
// Required methods
fn write_new(&self, path: &Path, data: &[u8]) -> Result<()>;
fn sync_file(&self, path: &Path) -> Result<()>;
fn rename(&self, from: &Path, to: &Path) -> Result<()>;
fn sync_dir(&self, dir: &Path) -> Result<()>;
fn read(&self, path: &Path) -> Result<Vec<u8>>;
fn remove(&self, path: &Path) -> Result<()>;
fn list(&self, dir: &Path) -> Result<Vec<OsString>>;
fn create_dir_all(&self, dir: &Path) -> Result<()>;
fn remove_dir_all(&self, dir: &Path) -> Result<()>;
}Expand description
The filesystem calls Store makes.
Required Methods§
Sourcefn write_new(&self, path: &Path, data: &[u8]) -> Result<()>
fn write_new(&self, path: &Path, data: &[u8]) -> Result<()>
Creates a file that must not exist yet and writes data to it,
without syncing.
Sourcefn rename(&self, from: &Path, to: &Path) -> Result<()>
fn rename(&self, from: &Path, to: &Path) -> Result<()>
Renames a file, replacing any file at to.
Sourcefn sync_dir(&self, dir: &Path) -> Result<()>
fn sync_dir(&self, dir: &Path) -> Result<()>
Makes a directory’s entries durable: files created, renamed or removed in it.
Sourcefn create_dir_all(&self, dir: &Path) -> Result<()>
fn create_dir_all(&self, dir: &Path) -> Result<()>
Creates a directory and its parents, without syncing. A new directory survives a crash once the directory holding it is synced.
Sourcefn remove_dir_all(&self, dir: &Path) -> Result<()>
fn remove_dir_all(&self, dir: &Path) -> Result<()>
Removes a directory and everything in it, without syncing. The removal survives a crash once the directory that held it is synced.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".