pub enum Delta<T> {
Unchanged,
Added(T),
Removed(T),
Changed(ChangedType<T>),
}
Expand description
Represents how a value changed.
This is used for statediff.
Variants§
Unchanged
Existing value didn’t change.
Added(T)
New storage value added.
Removed(T)
Existing storage value removed.
Changed(ChangedType<T>)
Existing storage value changed.
Implementations§
Source§impl<T> Delta<T>
impl<T> Delta<T>
Sourcepub const fn changed(from: T, to: T) -> Self
pub const fn changed(from: T, to: T) -> Self
Creates a new Delta::Changed variant
Sourcepub const fn is_unchanged(&self) -> bool
pub const fn is_unchanged(&self) -> bool
Returns true if the value is unchanged
Sourcepub const fn is_removed(&self) -> bool
pub const fn is_removed(&self) -> bool
Returns true if the value is removed
Sourcepub const fn is_changed(&self) -> bool
pub const fn is_changed(&self) -> bool
Returns true if the value is changed
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Delta<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Delta<T>where
T: Deserialize<'de>,
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
impl<T: Eq> Eq for Delta<T>
impl<T> StructuralPartialEq for Delta<T>
Auto Trait Implementations§
impl<T> Freeze for Delta<T>where
T: Freeze,
impl<T> RefUnwindSafe for Delta<T>where
T: RefUnwindSafe,
impl<T> Send for Delta<T>where
T: Send,
impl<T> Sync for Delta<T>where
T: Sync,
impl<T> Unpin for Delta<T>where
T: Unpin,
impl<T> UnwindSafe for Delta<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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