Trait StoreDirectory

Source
pub trait StoreDirectory {
    type Entry;
    type Reader: StoreDirectoryReader<Self::Entry>;

    // Required methods
    fn path(&self) -> &Path;
    fn exists(&self) -> impl Future<Output = Result<bool>>;
    fn read(&self) -> impl Future<Output = Result<Self::Reader>>;
    fn delete(&self) -> impl Future<Output = Result<()>>;
    fn delete_recursive(&self) -> impl Future<Output = Result<()>>;

    // Provided method
    fn name(&self) -> Option<Cow<'_, str>> { ... }
}
Expand description

Trait representing a directory in the storage system.

Required Associated Types§

Source

type Entry

Associated type for entries in the directory.

Source

type Reader: StoreDirectoryReader<Self::Entry>

Associated type for the reader that iterates over the directory’s entries.

Required Methods§

Source

fn path(&self) -> &Path

Gives the relative path of the directory

Source

fn exists(&self) -> impl Future<Output = Result<bool>>

Checks if the directory exists.

Returns a future that resolves to true if the directory exists, otherwise false.

Source

fn read(&self) -> impl Future<Output = Result<Self::Reader>>

Reads the contents of the directory.

Returns a future that resolves to a reader for the directory’s entries.

Source

fn delete(&self) -> impl Future<Output = Result<()>>

Deletes a directory if empty

Should return an error if not empty

Source

fn delete_recursive(&self) -> impl Future<Output = Result<()>>

Deletes a directory and its content

Provided Methods§

Source

fn name(&self) -> Option<Cow<'_, str>>

Gives the name of the directory

Returns None if root directory

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§