Struct agera::file::DirectoryReference  
source · pub struct DirectoryReference(/* private fields */);Expand description
DirectoryReference represents a reference to a directory in the file system.
Browser support
Unlike with File objects, all operations on DirectoryReference are asynchronous and are
designed to be compatible with the browser.
Implementations§
source§impl DirectoryReference
 
impl DirectoryReference
sourcepub fn name(&self) -> String
 
pub fn name(&self) -> String
The name of a directory. This operation returns the last segment of the full directory path, including any file extensions.
sourcepub async fn entries(&self) -> Result<Vec<FileSystemReference>>
 
pub async fn entries(&self) -> Result<Vec<FileSystemReference>>
Returns the entries of a directory.
sourcepub async fn get_directory(&self, name: &str) -> Result<DirectoryReference>
 
pub async fn get_directory(&self, name: &str) -> Result<DirectoryReference>
Attempts to get a directory entry.
name is taken as the entry filename.
Errors
- Returns Errif the specified filename is invalid.
- Returns Errif the directory does not exist or is a file.
sourcepub async fn get_directory_or_create(
    &self,
    name: &str
) -> Result<DirectoryReference>
 
pub async fn get_directory_or_create( &self, name: &str ) -> Result<DirectoryReference>
Attempts to get a directory entry or creates it if it does not exist.
name is taken as the entry filename.
Errors
- Returns Errif the specified filename is invalid.
- Returns Errif a file of the specified filename already exists.
sourcepub async fn get_file(&self, name: &str) -> Result<FileReference>
 
pub async fn get_file(&self, name: &str) -> Result<FileReference>
Attempts to get a file entry.
name is taken as the entry filename.
Errors
- Returns Errif the specified filename is invalid.
- Returns Errif the file does not exist or is a directory.
sourcepub async fn get_file_or_create(&self, name: &str) -> Result<FileReference>
 
pub async fn get_file_or_create(&self, name: &str) -> Result<FileReference>
Attempts to get a file entry or creates it if it does not exist.
name is taken as the entry filename.
Errors
- Returns Errif the specified filename is invalid.
- Returns Errif a directory of the specified filename already exists.
sourcepub async fn delete_empty_directory(&self, name: &str) -> Result<()>
 
pub async fn delete_empty_directory(&self, name: &str) -> Result<()>
Deletes an empty entry directory. name is taken as the entry filename.
sourcepub async fn delete_directory_all(&self, name: &str) -> Result<()>
 
pub async fn delete_directory_all(&self, name: &str) -> Result<()>
Deletes a directory entry recursively. name is taken as the entry filename.
sourcepub async fn delete_file(&self, name: &str) -> Result<()>
 
pub async fn delete_file(&self, name: &str) -> Result<()>
Deletes a file entry. name is taken as the entry filename.
Trait Implementations§
source§impl Clone for DirectoryReference
 
impl Clone for DirectoryReference
source§fn clone(&self) -> DirectoryReference
 
fn clone(&self) -> DirectoryReference
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more