Trait Store

Source
pub trait Store {
    type Directory: StoreDirectory;
    type File: StoreFile;

    // Required methods
    fn get_dir<P: Into<PathBuf>>(
        &self,
        path: P,
    ) -> impl Future<Output = Result<Self::Directory>>;
    fn get_file<P: Into<PathBuf>>(
        &self,
        path: P,
    ) -> impl Future<Output = Result<Self::File>>;

    // Provided method
    fn root(&self) -> impl Future<Output = Result<Self::Directory>> { ... }
}
Expand description

Trait representing a generic storage system.

Required Associated Types§

Source

type Directory: StoreDirectory

Associated type for directories in the storage system.

Source

type File: StoreFile

Associated type for files in the storage system.

Required Methods§

Source

fn get_dir<P: Into<PathBuf>>( &self, path: P, ) -> impl Future<Output = Result<Self::Directory>>

Retrieves a directory at the specified path.

This method returns a future that resolves to the directory at the given path.

Source

fn get_file<P: Into<PathBuf>>( &self, path: P, ) -> impl Future<Output = Result<Self::File>>

Retrieves a file at the specified path.

This method returns a future that resolves to the file at the given path.

Provided Methods§

Source

fn root(&self) -> impl Future<Output = Result<Self::Directory>>

Returns the root directory of the store.

The root is represented by a default (empty) PathBuf.

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§