FileSystem

Trait FileSystem 

Source
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§

Source

fn chmod<P: AsRef<Path>>( &self, path: P, perm: Permissions, ) -> Result<(), Self::FSError>

Source

fn create_file<P: AsRef<Path>>( &self, path: P, ) -> Result<Self::File, Self::FSError>

Source

fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>

Source

fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>

Source

fn open_file<P: AsRef<Path>>( &self, path: P, ) -> Result<Self::File, Self::FSError>

Source

fn read_dir<P: AsRef<Path>>( &self, path: P, ) -> Result<Vec<Self::DirEntry>, Self::FSError>

Source

fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>

Source

fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>

Source

fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::FSError>

Source

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.

Implementors§