pub struct Store<R: Runtime> { /* private fields */ }Implementations§
Source§impl<R: Runtime> Store<R>
impl<R: Runtime> Store<R>
Sourcepub fn app_handle(&self) -> &AppHandle<R>
pub fn app_handle(&self) -> &AppHandle<R>
Gets a handle to the application instance.
Sourcepub fn state(&self) -> &StoreState
pub fn state(&self) -> &StoreState
Gets a reference to the store state.
Sourcepub fn try_state<T: DeserializeOwned>(&self) -> Result<T>
pub fn try_state<T: DeserializeOwned>(&self) -> Result<T>
Tries to parse the store state as an instance of type T.
Sourcepub fn try_get<T: DeserializeOwned>(&self, key: impl AsRef<str>) -> Result<T>
pub fn try_get<T: DeserializeOwned>(&self, key: impl AsRef<str>) -> Result<T>
Gets a value from the store and tries to parse it as an instance of type T.
Sourcepub fn entries(&self) -> impl Iterator<Item = (&String, &Json)>
pub fn entries(&self) -> impl Iterator<Item = (&String, &Json)>
Creates an iterator over the store entries.
Sourcepub fn save_on_change(&mut self, enabled: bool)
pub fn save_on_change(&mut self, enabled: bool)
Whether to save the store on state change.
Sourcepub fn save_strategy(&self) -> SaveStrategy
pub fn save_strategy(&self) -> SaveStrategy
Current save strategy used by this store.
Sourcepub fn set_save_strategy(&mut self, strategy: SaveStrategy)
pub fn set_save_strategy(&mut self, strategy: SaveStrategy)
Sets the save strategy for this store. Calling this will abort any pending save operation.
Sourcepub fn set_options_with_source<S>(
&mut self,
options: StoreOptions,
source: S,
) -> Result<()>where
S: Into<EventSource>,
pub fn set_options_with_source<S>(
&mut self,
options: StoreOptions,
source: S,
) -> Result<()>where
S: Into<EventSource>,
Sets the store options, optionally having a window as the source.
Sourcepub fn set_options(&mut self, options: StoreOptions) -> Result<()>
pub fn set_options(&mut self, options: StoreOptions) -> Result<()>
Sets the store options.
Source§impl<R: Runtime> Store<R>
impl<R: Runtime> Store<R>
Sourcepub fn set(&mut self, key: impl AsRef<str>, value: Json) -> Result<()>
pub fn set(&mut self, key: impl AsRef<str>, value: Json) -> Result<()>
Sets a key-value pair in the store.
Sourcepub fn patch_with_source<S>(
&mut self,
state: StoreState,
source: S,
) -> Result<()>where
S: Into<EventSource>,
pub fn patch_with_source<S>(
&mut self,
state: StoreState,
source: S,
) -> Result<()>where
S: Into<EventSource>,
Patches the store state, optionally having a window as the source.
Sourcepub fn patch(&mut self, state: StoreState) -> Result<()>
pub fn patch(&mut self, state: StoreState) -> Result<()>
Patches the store state.
Trait Implementations§
Auto Trait Implementations§
impl<R> !Freeze for Store<R>
impl<R> !RefUnwindSafe for Store<R>
impl<R> Send for Store<R>
impl<R> Sync for Store<R>
impl<R> Unpin for Store<R>
impl<R> !UnwindSafe for Store<R>
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