pub enum CuLatchedState<T: Clone> {
Unset,
Set(T),
}Expand description
Consumer-side cache updated by CuLatchedStateUpdate.
This is typically stored in a task struct and updated as messages arrive. It is not a runtime-managed global store; each consumer keeps its own copy of the latched state so replay and deterministic execution follow the same update sequence as live execution.
Variants§
Unset
No value has been latched yet, or the previous value was cleared.
Set(T)
The most recently latched value.
Implementations§
Source§impl<T: Clone> CuLatchedState<T>
impl<T: Clone> CuLatchedState<T>
Sourcepub fn as_ref(&self) -> Option<&T>
pub fn as_ref(&self) -> Option<&T>
Returns the currently latched value as a shared reference, if any.
This is equivalent to Self::get.
Sourcepub fn take(&mut self) -> Option<T>
pub fn take(&mut self) -> Option<T>
Removes and returns the currently latched value, leaving the state unset.
Sourcepub fn update_owned(&mut self, update: CuLatchedStateUpdate<T>)
pub fn update_owned(&mut self, update: CuLatchedStateUpdate<T>)
Applies an owned update without cloning the payload value.
Source§impl<T: Clone> CuLatchedState<T>
impl<T: Clone> CuLatchedState<T>
Sourcepub fn update(&mut self, update: &CuLatchedStateUpdate<T>)
pub fn update(&mut self, update: &CuLatchedStateUpdate<T>)
Applies a borrowed update, cloning only when the update contains a new value.
Trait Implementations§
Source§impl<'__de, T, __Context> BorrowDecode<'__de, __Context> for CuLatchedState<T>where
T: BorrowDecode<'__de, __Context> + Clone,
impl<'__de, T, __Context> BorrowDecode<'__de, __Context> for CuLatchedState<T>where
T: BorrowDecode<'__de, __Context> + Clone,
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<T: Clone + Clone> Clone for CuLatchedState<T>
impl<T: Clone + Clone> Clone for CuLatchedState<T>
Source§fn clone(&self) -> CuLatchedState<T>
fn clone(&self) -> CuLatchedState<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, __Context> Decode<__Context> for CuLatchedState<T>
impl<T, __Context> Decode<__Context> for CuLatchedState<T>
Source§impl<T: Clone> Default for CuLatchedState<T>
impl<T: Clone> Default for CuLatchedState<T>
Source§fn default() -> CuLatchedState<T>
fn default() -> CuLatchedState<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for CuLatchedState<T>where
T: Deserialize<'de> + Clone,
impl<'de, T> Deserialize<'de> for CuLatchedState<T>where
T: Deserialize<'de> + Clone,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Encode for CuLatchedState<T>
impl<T> Encode for CuLatchedState<T>
Source§impl<T> Serialize for CuLatchedState<T>
impl<T> Serialize for CuLatchedState<T>
Source§impl<T: Clone> TypePath for CuLatchedState<T>
impl<T: Clone> TypePath for CuLatchedState<T>
impl<T: Clone> StructuralPartialEq for CuLatchedState<T>
Auto Trait Implementations§
impl<T> Freeze for CuLatchedState<T>where
T: Freeze,
impl<T> RefUnwindSafe for CuLatchedState<T>where
T: RefUnwindSafe,
impl<T> Send for CuLatchedState<T>where
T: Send,
impl<T> Sync for CuLatchedState<T>where
T: Sync,
impl<T> Unpin for CuLatchedState<T>where
T: Unpin,
impl<T> UnsafeUnpin for CuLatchedState<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for CuLatchedState<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more