SharedStateStore

Struct SharedStateStore 

Source
pub struct SharedStateStore<T: Clone + Send + Sync>(pub Arc<InMemoryStateStore<T>>);
Expand description

Wrapper struct to implement StateStore on Arc<InMemoryStateStore<T>>

Tuple Fields§

§0: Arc<InMemoryStateStore<T>>

Trait Implementations§

Source§

impl<T: Clone + Send + Sync> Clone for SharedStateStore<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Clone + Send + Sync> Debug for SharedStateStore<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone + Send + Sync> StateStore<T> for SharedStateStore<T>

Source§

fn get(&self) -> StateResult<Option<T>>

Get a read-only reference to the current state. Read more
Source§

fn set(&self, state: T) -> StateResult<()>

Set the state to a new value.
Source§

fn update_with( &self, f: Box<dyn FnOnce(Option<T>) -> T + Send>, ) -> StateResult<T>

Update the state using a boxed function. Read more
Source§

fn reset(&self) -> StateResult<()>

Reset the state to its initial value or clear it.
Source§

fn is_initialized(&self) -> bool

Check if the state has been initialized.
Source§

fn initial_state(&self) -> Option<T>

Get the initial state value if one was provided.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> CheckpointableStateStore<S> for T

Source§

fn create_json_checkpoint(&self) -> Result<Vec<u8>, CheckpointError>

Create a JSON checkpoint of the current state.
Source§

fn restore_from_json_checkpoint( &self, data: &[u8], ) -> Result<(), CheckpointError>

Restore state from a JSON checkpoint.
Source§

fn create_json_checkpoint_pretty(&self) -> Result<Vec<u8>, CheckpointError>

Create a pretty-printed JSON checkpoint of the current state.
Source§

fn save_checkpoint( &self, checkpoint_store: &dyn CheckpointStore, ) -> Result<(), CheckpointError>

Save the current state to a checkpoint store.
Source§

fn load_checkpoint( &self, checkpoint_store: &dyn CheckpointStore, ) -> Result<bool, CheckpointError>

Load state from a checkpoint store.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S, T> StateCheckpoint<S> for T

Source§

fn serialize_state(&self) -> Result<Vec<u8>, StateError>

Serialize the current state to a byte vector. Read more
Source§

fn deserialize_and_set_state(&self, data: &[u8]) -> Result<(), StateError>

Deserialize state from a byte vector and set it. Read more
Source§

impl<S, T> StateStoreExt<S> for T
where S: Clone + Send + Sync + 'static, T: StateStore<S>,

Source§

fn update<F>(&self, f: F) -> Result<S, StateError>
where F: FnOnce(Option<S>) -> S + Send + 'static,

Update the state using a closure. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V