pub trait FileSystem {
type FSError;
type File: File;
type DirEntry: DirEntry;
// Required methods
fn chmod<P: AsRef<Path>>(
&self,
path: P,
perm: Permissions,
) -> Result<(), Self::FSError>;
fn create_file<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Self::File, Self::FSError>;
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>;
fn create_dir_all<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), Self::FSError>;
fn open_file<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Self::File, Self::FSError>;
fn read_dir<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Vec<Self::DirEntry>, Self::FSError>;
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>;
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>;
fn remove_dir_all<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), Self::FSError>;
fn rename<P: AsRef<Path>>(
&self,
from: P,
to: P,
) -> Result<(), Self::FSError>;
}Expand description
The FileSystem trait needs to be implemented if you want a fully available abstract filesystem. For now we have few implementations as OSFileSystem, S3FileSystem, SFTPFileSystem, SSHFileSystem, MemFileSystem
Required Associated Types§
Required Methods§
fn chmod<P: AsRef<Path>>( &self, path: P, perm: Permissions, ) -> Result<(), Self::FSError>
fn create_file<P: AsRef<Path>>( &self, path: P, ) -> Result<Self::File, Self::FSError>
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>
fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>
fn open_file<P: AsRef<Path>>( &self, path: P, ) -> Result<Self::File, Self::FSError>
fn read_dir<P: AsRef<Path>>( &self, path: P, ) -> Result<Vec<Self::DirEntry>, Self::FSError>
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>
fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>
fn rename<P: AsRef<Path>>(&self, from: P, to: P) -> 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.