pub trait FileSystem {
// Required methods
fn read_dir(&self, dir: &Path) -> Result<Vec<FsEntry>>;
fn canonicalize(&self, path: &Path) -> Result<PathBuf>;
fn metadata(&self, path: &Path) -> Result<FsMetadata>;
fn create_dir(&self, path: &Path) -> Result<()>;
fn rename(&self, from: &Path, to: &Path) -> Result<()>;
fn remove_file(&self, path: &Path) -> Result<()>;
fn remove_dir(&self, path: &Path) -> Result<()>;
fn remove_dir_all(&self, path: &Path) -> Result<()>;
fn copy_file(&self, from: &Path, to: &Path) -> Result<u64>;
}Expand description
File system abstraction (IGFD IFileSystem-like).
This is a first incremental step; the API will expand as Places/devices, directory creation, symlink support, and async enumeration are added.
Required Methods§
Sourcefn canonicalize(&self, path: &Path) -> Result<PathBuf>
fn canonicalize(&self, path: &Path) -> Result<PathBuf>
Canonicalize a path (best-effort absolute normalization).
Sourcefn metadata(&self, path: &Path) -> Result<FsMetadata>
fn metadata(&self, path: &Path) -> Result<FsMetadata>
Fetch minimal metadata for a path.
Sourcefn create_dir(&self, path: &Path) -> Result<()>
fn create_dir(&self, path: &Path) -> Result<()>
Create a directory.
Sourcefn remove_file(&self, path: &Path) -> Result<()>
fn remove_file(&self, path: &Path) -> Result<()>
Remove a file.
Sourcefn remove_dir(&self, path: &Path) -> Result<()>
fn remove_dir(&self, path: &Path) -> Result<()>
Remove an empty directory.
Sourcefn remove_dir_all(&self, path: &Path) -> Result<()>
fn remove_dir_all(&self, path: &Path) -> Result<()>
Remove a directory and all of its contents (recursive).