pub trait PreferencesStore: Send + Sync {
// Required methods
fn get(&self, key: &str) -> Option<String>;
fn set(&self, key: &str, value: &str) -> Result<(), PreferencesError>;
fn remove(&self, key: &str) -> Result<(), PreferencesError>;
fn keys(&self) -> Vec<String>;
fn clear(&self) -> Result<(), PreferencesError>;
}Expand description
Re-export framework services (HTTP, URI, etc.) from the dedicated services crate. Durable key/value storage owned by the application.
Implementations are Send + Sync: preferences are written from wherever the
decision is made, including a worker thread.
Required Methods§
Sourcefn remove(&self, key: &str) -> Result<(), PreferencesError>
fn remove(&self, key: &str) -> Result<(), PreferencesError>
Removes key. Succeeds if it is already absent.
Sourcefn clear(&self) -> Result<(), PreferencesError>
fn clear(&self) -> Result<(), PreferencesError>
Removes everything.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl PreferencesStore for FilePreferences
Available on non-WebAssembly only.