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 rename_new(&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.
§Errors
AlreadyExists if the path is taken, NotFound if its directory
does not exist, or any other I/O error.
Sourcefn rename_new(&self, from: &Path, to: &Path) -> Result<()>
fn rename_new(&self, from: &Path, to: &Path) -> Result<()>
Renames a file only if nothing has the name to, in one step: of
two callers renaming onto one name, one is refused.
§Errors
AlreadyExists if to is taken, or the I/O error that stopped the
rename.
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.
§Errors
NotFound if there is no such directory, or any other I/O error.
Sourcefn remove(&self, path: &Path) -> Result<()>
fn remove(&self, path: &Path) -> Result<()>
Removes a file.
§Errors
NotFound if there is no such file, an error if the path is a
directory, or any other I/O error.
Sourcefn list(&self, dir: &Path) -> Result<Vec<OsString>>
fn list(&self, dir: &Path) -> Result<Vec<OsString>>
The names in a directory, sorted.
§Errors
NotFound if there is no such directory, or any other I/O error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".