StorageBacking

Trait StorageBacking 

Source
pub trait StorageBacking: Clone + 'static {
    type Key: PartialEq + Clone + Debug + Send + Sync + 'static;

    // Required methods
    fn get<T: DeserializeOwned + Clone + 'static>(key: &Self::Key) -> Option<T>;
    fn set<T: Serialize + Send + Sync + Clone + 'static>(
        key: Self::Key,
        value: &T,
    );
}
Expand description

A trait for a storage backing

Required Associated Types§

Source

type Key: PartialEq + Clone + Debug + Send + Sync + 'static

The key type used to store data in storage

Required Methods§

Source

fn get<T: DeserializeOwned + Clone + 'static>(key: &Self::Key) -> Option<T>

Gets a value from storage for the given key

Source

fn set<T: Serialize + Send + Sync + Clone + 'static>(key: Self::Key, value: &T)

Sets a value in storage for the given key

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§