pub struct CombinedState<T> {
pub current: Option<T>,
pub staging: Vec<StateChange<T>>,
pub legacy_state_key: Option<Value>,
}Fields§
§current: Option<T>§staging: Vec<StateChange<T>>§legacy_state_key: Option<Value>Legacy state keys that no longer identical to the latest serialized form (usually caused by code change). They will be deleted when the next change is applied.
Implementations§
Source§impl<T> CombinedState<T>
impl<T> CombinedState<T>
pub fn current(desired: T) -> Self
pub fn staging(change: StateChange<T>) -> Self
pub fn from_change(
prev: Option<CombinedState<T>>,
change: Option<Option<&T>>,
) -> Selfwhere
T: Clone,
pub fn possible_versions(&self) -> impl Iterator<Item = &T>
pub fn always_exists(&self) -> bool
pub fn always_exists_and(&self, predicate: impl Fn(&T) -> bool) -> bool
pub fn legacy_values<V: Ord + Eq, F: Fn(&T) -> &V>( &self, desired: Option<&T>, f: F, ) -> BTreeSet<&V>
pub fn has_state_diff<S>(
&self,
state: Option<&S>,
map_fn: impl Fn(&T) -> &S,
) -> boolwhere
S: PartialEq,
Trait Implementations§
Source§impl<T: Clone> Clone for CombinedState<T>
impl<T: Clone> Clone for CombinedState<T>
Source§fn clone(&self) -> CombinedState<T>
fn clone(&self) -> CombinedState<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: Debug> Debug for CombinedState<T>
impl<T: Debug> Debug for CombinedState<T>
Auto Trait Implementations§
impl<T> Freeze for CombinedState<T>where
T: Freeze,
impl<T> RefUnwindSafe for CombinedState<T>where
T: RefUnwindSafe,
impl<T> Send for CombinedState<T>where
T: Send,
impl<T> Sync for CombinedState<T>where
T: Sync,
impl<T> Unpin for CombinedState<T>where
T: Unpin,
impl<T> UnwindSafe for CombinedState<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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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