SettingsStoreExt

Trait SettingsStoreExt 

Source
pub trait SettingsStoreExt {
    // Required methods
    fn read_obj<V: DeserializeOwned>(&self, key: &str) -> Result<Option<V>>;
    fn write_obj<V: Serialize>(&self, key: &str, value: &V) -> Result<()>;
    fn require_obj<V: DeserializeOwned>(&self, key: &str) -> Result<V>;
}
Expand description

Extension trait for the SettingsStore trait. It is implemented for all types that implement SettingsStore. It provides methods for writing and reading any serializable object from the store.

Required Methods§

Source

fn read_obj<V: DeserializeOwned>(&self, key: &str) -> Result<Option<V>>

Source

fn write_obj<V: Serialize>(&self, key: &str, value: &V) -> Result<()>

Source

fn require_obj<V: DeserializeOwned>(&self, key: &str) -> Result<V>

Same as SettingsStoreExt::read_obj, but returns an error if the key does not exist.

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§