component_debug::io

Trait Directory

Source
pub trait Directory: Sized {
    // Required methods
    fn open_dir_readonly<P: AsRef<Path> + Send>(
        &self,
        relative_path: P,
    ) -> Result<Self>;
    fn open_dir_readwrite<P: AsRef<Path> + Send>(
        &self,
        relative_path: P,
    ) -> Result<Self>;
    fn create_dir<P: AsRef<Path> + Send>(
        &self,
        relative_path: P,
        readwrite: bool,
    ) -> Result<Self>;
    fn clone(&self) -> Result<Self>;
    fn read_file<'life0, 'async_trait, P>(
        &'life0 self,
        relative_path: P,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where P: 'async_trait + AsRef<Path> + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn read_file_bytes<'life0, 'async_trait, P>(
        &'life0 self,
        relative_path: P,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where P: 'async_trait + AsRef<Path> + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filename: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn entry_type<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filename: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DirentKind>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        relative_path: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_file<'life0, 'life1, 'async_trait, P>(
        &'life0 self,
        relative_path: P,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where P: 'async_trait + AsRef<Path> + Send,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_file_size<'life0, 'async_trait, P>(
        &'life0 self,
        relative_path: P,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where P: 'async_trait + AsRef<Path> + Send,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn entry_names<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn open_dir_readonly<P: AsRef<Path> + Send>( &self, relative_path: P, ) -> Result<Self>

Attempts to open the directory at relative_path with read-only rights.

Source

fn open_dir_readwrite<P: AsRef<Path> + Send>( &self, relative_path: P, ) -> Result<Self>

Attempts to open the directory at relative_path with read/write rights.

Source

fn create_dir<P: AsRef<Path> + Send>( &self, relative_path: P, readwrite: bool, ) -> Result<Self>

Attempts to create a directory at relative_path with read right (if readwrite is false) or read/write rights (if readwrite is true).

Source

fn clone(&self) -> Result<Self>

Return a copy of self.

Source

fn read_file<'life0, 'async_trait, P>( &'life0 self, relative_path: P, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait, 'life0: 'async_trait,

Returns the contents of the file at relative_path as a string.

Source

fn read_file_bytes<'life0, 'async_trait, P>( &'life0 self, relative_path: P, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait, 'life0: 'async_trait,

Returns the contents of the file at relative_path as bytes.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, filename: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns true if an entry called filename exists in this directory. filename must be a plain file name, not a relative path.

Source

fn entry_type<'life0, 'life1, 'async_trait>( &'life0 self, filename: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DirentKind>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the type of entry specified by filename, or None if no entry by that name is found. filename must be a plan file name, not a relative path.

Source

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

Deletes the file at relative_path.

Source

fn write_file<'life0, 'life1, 'async_trait, P>( &'life0 self, relative_path: P, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes data to a file at relative_path. Overwrites if the file already exists.

Source

fn get_file_size<'life0, 'async_trait, P>( &'life0 self, relative_path: P, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where P: 'async_trait + AsRef<Path> + Send, Self: 'async_trait, 'life0: 'async_trait,

Returns the size of the file at relative_path in bytes.

Source

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

Returns a list of directory entry names as strings.

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§