pub trait FileSystem {
// Required methods
fn duplicate(&self) -> Box<dyn FileSystem>;
fn subsystem(&self, path: &Path) -> Box<dyn FileSystem>;
fn exists(&self, path: &Path) -> bool;
fn read(
&self,
path: &Path,
f: &mut dyn FnMut(&mut dyn ReadSeek) -> IoResult<()>,
) -> IoResult<()>;
fn write(
&self,
path: &Path,
f: &mut dyn FnMut(&mut dyn Write) -> IoResult<()>,
) -> IoResult<()>;
fn full_path_for(&self, path: &Path) -> PathBuf;
fn files(&self) -> Vec<PathBuf>;
fn remove(&self, path: &Path) -> IoResult<()>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn copy(&self, from: &Path, to: &Path) -> IoResult<()> { ... }
}Required Methods§
fn duplicate(&self) -> Box<dyn FileSystem>
fn subsystem(&self, path: &Path) -> Box<dyn FileSystem>
fn exists(&self, path: &Path) -> bool
fn read( &self, path: &Path, f: &mut dyn FnMut(&mut dyn ReadSeek) -> IoResult<()>, ) -> IoResult<()>
fn write( &self, path: &Path, f: &mut dyn FnMut(&mut dyn Write) -> IoResult<()>, ) -> IoResult<()>
fn full_path_for(&self, path: &Path) -> PathBuf
fn files(&self) -> Vec<PathBuf>
fn remove(&self, path: &Path) -> IoResult<()>
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".