settings_storage::storage_factory

Trait StorageFactory

Source
pub trait StorageFactory {
    type Storage;

    // Required methods
    fn initialize<T>(&self) -> impl Future<Output = Result<(), Error>>
       where T: StorageAccess<Storage = Self::Storage>;
    fn initialize_with_loader<T, L>(
        &self,
        loader: L,
    ) -> impl Future<Output = Result<(), Error>>
       where T: StorageAccess<Storage = Self::Storage>,
             L: DefaultLoader<Result = T::Data> + 'static;
    fn get_store(&self) -> impl Future<Output = Rc<Self::Storage>>;
}
Expand description

DeviceStorageFactory abstracts over how to initialize and retrieve the DeviceStorage instance.

Required Associated Types§

Source

type Storage

The storage type used to manage persisted data.

Required Methods§

Source

fn initialize<T>(&self) -> impl Future<Output = Result<(), Error>>
where T: StorageAccess<Storage = Self::Storage>,

Initialize the storage to be able to manage storage for objects of type T. This will return an Error once get_store is called the first time.

Source

fn initialize_with_loader<T, L>( &self, loader: L, ) -> impl Future<Output = Result<(), Error>>
where T: StorageAccess<Storage = Self::Storage>, L: DefaultLoader<Result = T::Data> + 'static,

Initialize the storage to be able to manage storage for objects of type T. This will return an Error once get_store is called the first time.

Source

fn get_store(&self) -> impl Future<Output = Rc<Self::Storage>>

Retrieve the store singleton instance.

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§