pub struct DeviceStorage { /* private fields */ }
Expand description
Stores device level settings in persistent storage. User level settings should not use this.
Implementations§
Source§impl DeviceStorage
impl DeviceStorage
Sourcepub fn with_stash_proxy<I, G>(
iter: I,
stash_generator: G,
inspect_handle: Rc<Mutex<StashInspectLogger>>,
) -> Self
pub fn with_stash_proxy<I, G>( iter: I, stash_generator: G, inspect_handle: Rc<Mutex<StashInspectLogger>>, ) -> Self
Construct a device storage from the iteratable item, which will produce the keys for storage, and from a generator that will produce a stash proxy given a particular key.
Sourcepub fn set_caching_enabled(&mut self, enabled: bool)
pub fn set_caching_enabled(&mut self, enabled: bool)
Test-only
Sourcepub fn set_debounce_writes(&mut self, debounce: bool)
pub fn set_debounce_writes(&mut self, debounce: bool)
Test-only
Sourcepub async fn write<T>(&self, new_value: &T) -> Result<UpdateState, Error>where
T: DeviceStorageCompatible,
pub async fn write<T>(&self, new_value: &T) -> Result<UpdateState, Error>where
T: DeviceStorageCompatible,
Write new_value
to storage. The write will be persisted to disk at a set interval.
Sourcepub async fn write_str(
&self,
key: &'static str,
value: String,
) -> Result<(), Error>
pub async fn write_str( &self, key: &'static str, value: String, ) -> Result<(), Error>
Test-only method to write directly to stash without touching the cache. This is used for setting up data as if it existed on disk before the connection to stash was made.
Sourcepub async fn get<T>(&self) -> Twhere
T: DeviceStorageCompatible,
pub async fn get<T>(&self) -> Twhere
T: DeviceStorageCompatible,
Gets the latest value cached locally, or loads the value from storage. Doesn’t support multiple concurrent callers of the same struct.
Auto Trait Implementations§
impl Freeze for DeviceStorage
impl !RefUnwindSafe for DeviceStorage
impl !Send for DeviceStorage
impl !Sync for DeviceStorage
impl Unpin for DeviceStorage
impl !UnwindSafe for DeviceStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more