pub enum ScalarDelta<T> {
Unchanged,
Changed(T),
}Expand description
This type exists as a workaround for the serde data model being unable to distinguish
between Some(None) and None in serialized bytes. It is, in nearly every respect,
Option<T>, just with some more semantic clarity. You may freely convert between this
and Option<T> using From::from or Into::into.
Variants§
Unchanged
The value was not altered, use the old value.
Changed(T)
The value was altered, here is the new value.
Implementations§
Source§impl<T> ScalarDelta<T>
impl<T> ScalarDelta<T>
Sourcepub fn is_unchanged(&self) -> bool
pub fn is_unchanged(&self) -> bool
Returns true if this contains no change.
Sourcepub fn is_changed(&self) -> bool
pub fn is_changed(&self) -> bool
Returns true if this contains a change.
Trait Implementations§
Source§impl<T: Clone> Clone for ScalarDelta<T>
impl<T: Clone> Clone for ScalarDelta<T>
Source§fn clone(&self) -> ScalarDelta<T>
fn clone(&self) -> ScalarDelta<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy> Copy for ScalarDelta<T>
Source§impl<T: Debug> Debug for ScalarDelta<T>
impl<T: Debug> Debug for ScalarDelta<T>
Source§impl<T> Default for ScalarDelta<T>
impl<T> Default for ScalarDelta<T>
Source§fn default() -> ScalarDelta<T>
fn default() -> ScalarDelta<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for ScalarDelta<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ScalarDelta<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 ScalarDelta<T>
Source§impl<T> From<Option<T>> for ScalarDelta<T>
impl<T> From<Option<T>> for ScalarDelta<T>
Source§impl<T> From<ScalarDelta<T>> for Option<T>
impl<T> From<ScalarDelta<T>> for Option<T>
Source§fn from(value: ScalarDelta<T>) -> Self
fn from(value: ScalarDelta<T>) -> Self
Converts to this type from the input type.
Source§impl<T: Hash> Hash for ScalarDelta<T>
impl<T: Hash> Hash for ScalarDelta<T>
Source§impl<T: Ord> Ord for ScalarDelta<T>
impl<T: Ord> Ord for ScalarDelta<T>
Source§fn cmp(&self, other: &ScalarDelta<T>) -> Ordering
fn cmp(&self, other: &ScalarDelta<T>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for ScalarDelta<T>
impl<T: PartialEq> PartialEq for ScalarDelta<T>
Source§impl<T: PartialOrd> PartialOrd for ScalarDelta<T>
impl<T: PartialOrd> PartialOrd for ScalarDelta<T>
Source§impl<T> Serialize for ScalarDelta<T>where
T: Serialize,
impl<T> Serialize for ScalarDelta<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for ScalarDelta<T>
Auto Trait Implementations§
impl<T> Freeze for ScalarDelta<T>where
T: Freeze,
impl<T> RefUnwindSafe for ScalarDelta<T>where
T: RefUnwindSafe,
impl<T> Send for ScalarDelta<T>where
T: Send,
impl<T> Sync for ScalarDelta<T>where
T: Sync,
impl<T> Unpin for ScalarDelta<T>where
T: Unpin,
impl<T> UnsafeUnpin for ScalarDelta<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ScalarDelta<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