pub trait StorageHandle<T: Serialize + DeserializeOwned> {
    fn load(&self) -> Result<Option<T>, Error>;
    fn store(&self, val: &T) -> Result<(), Error>;
    fn can_store(&self) -> bool;
}
Expand description

A handle to a storage system that stores objects of a single type to a single location.

To get an object of this type, call StateMgr::create_handle.

Unlike StateMgr, this trait is object-safe.

Required Methods

Try to load the object from storage.

If no object exists, return Ok(None).

Try to store a value into storage.

Return true if we have the lock; see StateMgr::can_store.

Implementors