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§
Sourcefn open_dir_readonly<P: AsRef<Path> + Send>(
&self,
relative_path: P,
) -> Result<Self>
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.
Sourcefn open_dir_readwrite<P: AsRef<Path> + Send>(
&self,
relative_path: P,
) -> Result<Self>
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.
Sourcefn create_dir<P: AsRef<Path> + Send>(
&self,
relative_path: P,
readwrite: bool,
) -> Result<Self>
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).
Sourcefn read_file<'life0, 'async_trait, P>(
&'life0 self,
relative_path: P,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
fn read_file<'life0, 'async_trait, P>( &'life0 self, relative_path: P, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
Returns the contents of the file at relative_path
as a string.
Sourcefn read_file_bytes<'life0, 'async_trait, P>(
&'life0 self,
relative_path: P,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + '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>>
Returns the contents of the file at relative_path
as bytes.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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
.
Sourcefn write_file<'life0, 'life1, 'async_trait, P>(
&'life0 self,
relative_path: P,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '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>>
Writes data
to a file at relative_path
. Overwrites if the file already
exists.
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.