Skip to main content

Fs

Trait Fs 

Source
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§

Source

fn write_new(&self, path: &Path, data: &[u8]) -> Result<()>

Creates a file that must not exist yet and writes data to it, without syncing.

Source

fn sync_file(&self, path: &Path) -> Result<()>

Makes a file’s data durable.

Source

fn rename(&self, from: &Path, to: &Path) -> Result<()>

Renames a file, replacing any file at to.

Source

fn sync_dir(&self, dir: &Path) -> Result<()>

Makes a directory’s entries durable: files created, renamed or removed in it.

Source

fn read(&self, path: &Path) -> Result<Vec<u8>>

Reads a whole file.

Source

fn remove(&self, path: &Path) -> Result<()>

Removes a file.

Source

fn list(&self, dir: &Path) -> Result<Vec<OsString>>

The names in a directory, sorted.

Source

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.

Source

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".

Implementors§

Source§

impl Fs for OsFs