Skip to main content

WritableFileSystem

Trait WritableFileSystem 

Source
pub trait WritableFileSystem:
    Debug
    + Send
    + Sync {
    // Required methods
    fn create_dir<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dir: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_dir_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dir: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        file: &'life1 Utf8Path,
        data: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_dir_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dir: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_dir<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dir: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stat<'life0, 'life1, 'async_trait>(
        &'life0 self,
        file: &'life1 Utf8Path,
    ) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_permissions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _path: &'life1 Utf8Path,
        _perm: FilePermissions,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn create_dir<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new, empty directory at the provided path.

NOTE: If a parent of the given path doesn’t exist, this function is supposed to return an error. To create a directory and all its missing parents at the same time, use the [create_dir_all] function.

Error: This function is supposed to return an error in the following situations, but is not limited to just these cases:

  • User lacks permissions to create directory at path.
  • A parent of the given path doesn’t exist. (To create a directory and all its missing parents at the same time, use the create_dir_all function.)
  • Path already exists.
Source

fn create_dir_all<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Recursively create a directory and all of its parent components if they are missing.

Source

fn write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, file: &'life1 Utf8Path, data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a slice as the entire contents of a file. This function will create a file if it does not exist, and will entirely replace its contents if it does.

Source

fn remove_file<'life0, 'life1, 'async_trait>( &'life0 self, file: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Removes a file from the filesystem.

Source

fn remove_dir_all<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Removes a directory at this path, after removing all its contents. Use carefully.

Source

fn read_dir<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a list of all files in a directory.

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, file: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the entire contents of a file into a bytes vector.

Source

fn stat<'life0, 'life1, 'async_trait>( &'life0 self, file: &'life1 Utf8Path, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn set_permissions<'life0, 'life1, 'async_trait>( &'life0 self, _path: &'life1 Utf8Path, _perm: FilePermissions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§