pub trait FileSystem: Clone {
type FSError: Debug;
// Required methods
fn exists<P: AsRef<Path>>(&self, path: P) -> Result<bool, Self::FSError>;
fn read<P: AsRef<Path>>(&self, filename: P) -> Result<String, Self::FSError>;
fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
&self,
filename: P,
contents: C,
) -> Result<(), Self::FSError>;
}Expand description
Trait representing a file system abstraction
Required Associated Types§
Required Methods§
fn exists<P: AsRef<Path>>(&self, path: P) -> Result<bool, Self::FSError>
fn read<P: AsRef<Path>>(&self, filename: P) -> Result<String, Self::FSError>
fn write<P: AsRef<Path>, C: AsRef<[u8]>>( &self, filename: P, contents: C, ) -> Result<(), Self::FSError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.