Skip to main content

Directory

Trait Directory 

Source
pub trait Directory<File>: Sized + Clone {
    // Required methods
    fn open_subdir(
        &self,
        name: &[u8],
    ) -> impl Future<Output = Result<Self, FileSystemError>>;
    fn list_dir(
        &self,
    ) -> impl Future<Output = Result<Vec<DirEntry>, FileSystemError>>;
    fn open_file(
        &self,
        name: &[u8],
    ) -> impl Future<Output = Result<File, FileSystemError>>;
}
Expand description

A trait for directories and their operations

A simple implementation might just use a std::path::PathBuf. On platforms which implement directory handles, this should encapsulate the handle.

Required Methods§

Source

fn open_subdir( &self, name: &[u8], ) -> impl Future<Output = Result<Self, FileSystemError>>

Open a subdirectory of this directory

Source

fn list_dir( &self, ) -> impl Future<Output = Result<Vec<DirEntry>, FileSystemError>>

List the entries in this directory

Source

fn open_file( &self, name: &[u8], ) -> impl Future<Output = Result<File, FileSystemError>>

Open a file (for reading)

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 Directory<WebFile> for WebDirectory

Available on crate feature web only.