Filesystem

Trait Filesystem 

Source
pub trait Filesystem {
    type File: AsyncRead + AsyncSeek + FileExt + Send + Sync + Unpin;
    type OpenFile<'a>: Future<Output = Result<Self::File>> + Send + Sync + 'a
       where Self: 'a;
    type IsDir<'a>: Future<Output = Result<bool>> + Send + Sync + 'a
       where Self: 'a;
    type Metadata<'a>: Future<Output = Result<Metadata>> + Send + Sync + 'a
       where Self: 'a;

    // Required methods
    fn open<'a>(&'a mut self, path: &'a Path) -> Self::OpenFile<'a>;
    fn is_dir<'a>(&'a self, path: &'a Path) -> Self::IsDir<'a>;
    fn metadata<'a>(&'a self, path: &'a Path) -> Self::Metadata<'a>;
}
Expand description

Define a filesystem trait

Required Associated Types§

Source

type File: AsyncRead + AsyncSeek + FileExt + Send + Sync + Unpin

Source

type OpenFile<'a>: Future<Output = Result<Self::File>> + Send + Sync + 'a where Self: 'a

Source

type IsDir<'a>: Future<Output = Result<bool>> + Send + Sync + 'a where Self: 'a

Source

type Metadata<'a>: Future<Output = Result<Metadata>> + Send + Sync + 'a where Self: 'a

Required Methods§

Source

fn open<'a>(&'a mut self, path: &'a Path) -> Self::OpenFile<'a>

open a file by path

Source

fn is_dir<'a>(&'a self, path: &'a Path) -> Self::IsDir<'a>

check the path is a dir or not

Source

fn metadata<'a>(&'a self, path: &'a Path) -> Self::Metadata<'a>

get Metadata by path

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§

Source§

impl Filesystem for DiskFilesystem

Source§

type File = DiskFile

Source§

type OpenFile<'a> = impl Future<Output = Result<<DiskFilesystem as Filesystem>::File, Error>> + Send + Sync + 'a where Self: 'a

Source§

type IsDir<'a> = impl Future<Output = Result<bool, Error>> + Send + Sync + 'a where Self: 'a

Source§

type Metadata<'a> = impl Future<Output = Result<Metadata, Error>> + Send + Sync + 'a where Self: 'a

Source§

impl Filesystem for IncludeDirFilesystem

Source§

type File = IncludeDirFile

Source§

type OpenFile<'a> = impl Future<Output = Result<<IncludeDirFilesystem as Filesystem>::File, Error>> + Send + Sync + 'a where Self: 'a

Source§

type IsDir<'a> = impl Future<Output = Result<bool, Error>> + Send + Sync + 'a where Self: 'a

Source§

type Metadata<'a> = impl Future<Output = Result<Metadata, Error>> + Send + Sync + 'a where Self: 'a