pub trait StorageSystem {
fn is_supported(&self) -> bool;
fn set<A: StorageItem>(&self, key: String, value: A) -> bool
where
Self: Sized;
fn get<A: StorageItem>(&self, key: String) -> Option<&A>
where
Self: Sized;
fn remove(&mut self, key: String);
fn clear(&mut self);
}
Expand description
A simple key/value store that persists between sessions.
Required Methods
fn is_supported(&self) -> bool
fn is_supported(&self) -> bool
True if the environment supports persisted storage. Otherwise, the storage is backed by a Map and not actually persisted between sessions.
Add a key to the storage, replacing any existing value. @param value An object that can be serialized with Serializer. @returns True if the value was successfully serialized and persisted.
Retrieve a value from storage for a given key.