Skip to main content

UpdateFileSystem

Trait UpdateFileSystem 

Source
pub trait UpdateFileSystem {
    // Required methods
    fn exists(&self, path: &Path) -> bool;
    fn rename(&self, from: &Path, to: &Path) -> Result<()>;
    fn copy(&self, from: &Path, to: &Path) -> Result<u64>;
    fn remove_file(&self, path: &Path) -> Result<()>;
    fn remove_dir_all(&self, path: &Path) -> Result<()>;
    fn create_dir_all(&self, path: &Path) -> Result<()>;
    fn permissions(&self, path: &Path) -> Result<Permissions>;
    fn set_permissions(
        &self,
        path: &Path,
        permissions: Permissions,
    ) -> Result<()>;
}
Expand description

Filesystem seam used by atomic replacement and Windows quarantine.

Required Methods§

Source

fn exists(&self, path: &Path) -> bool

Whether a path exists.

Source

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

Rename a path atomically within a filesystem.

§Errors

Propagates the underlying std::io error when the rename fails.

Source

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

Copy a file.

§Errors

Propagates the underlying std::io error when the copy fails.

Source

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

Remove a file if present.

§Errors

Propagates the underlying std::io error when the removal fails.

Source

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

Recursively remove a directory if present.

§Errors

Propagates the underlying std::io error when the removal fails.

Source

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

Recursively create a directory.

§Errors

Propagates the underlying std::io error when creation fails.

Source

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

Read file permissions.

§Errors

Propagates the underlying std::io error when metadata read fails.

Source

fn set_permissions(&self, path: &Path, permissions: Permissions) -> Result<()>

Set file permissions.

§Errors

Propagates the underlying std::io error when setting permissions fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§