settings_storage::storage_factory

Trait StorageAccess

Source
pub trait StorageAccess {
    type Storage;
    type Data;

    const STORAGE_KEY: &'static str;
}
Expand description

A trait for describing which storages an item needs access to. See StashDeviceStorageFactory::initialize for usage.

§Example


impl DeviceStorageCompatible for StorageItem {
   // ...
   const KEY: &'static str = "some_key";
}

impl StorageAccess for SomeItem {
    type Storage = DeviceStorage;
    const STORAGE_KEY: &'static str = StorageItem::KEY;
}

Required Associated Constants§

Source

const STORAGE_KEY: &'static str

This field should be populated with the key used by the corresponding storage mechanism.

Required Associated Types§

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§