Trait PersistedContainer

Source
pub trait PersistedContainer {
    type Value;

    // Required methods
    fn get_to_persist(&self) -> Self::Value;
    fn restore_persisted(&mut self, value: Self::Value);
}
Expand description

A container that can store and provide a persisted value. This is used in conjunction with PersistedLazy to define how to lazily get the value that should be persisted, and how to restore state when a persisted value is loaded during initialization.

Required Associated Types§

Source

type Value

The value to be persisted

Required Methods§

Source

fn get_to_persist(&self) -> Self::Value

Get the current value to persist in the store

Source

fn restore_persisted(&mut self, value: Self::Value)

Set the container’s value, based on value loaded from the store

Implementors§