pub enum PatchValue<T> {
Unchanged,
Set(T),
Clear,
}Expand description
One field’s requested change.
Variants§
Unchanged
The user did not name this field. Never mutates it.
Set(T)
Set to this value.
Clear
Empty the field, where the field supports clearing.
Implementations§
Source§impl<T> PatchValue<T>
impl<T> PatchValue<T>
Sourcepub fn is_unchanged(&self) -> bool
pub fn is_unchanged(&self) -> bool
Whether this value would change anything. The cheap form of the “already the requested state is a no-op” rule (data-model §2): a plan can skip the field without comparing it to the current value.
pub fn is_clear(&self) -> bool
Sourcepub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> PatchValue<U>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> PatchValue<U>
Map the payload, leaving the variant alone.
Trait Implementations§
Source§impl<T: Clone> Clone for PatchValue<T>
impl<T: Clone> Clone for PatchValue<T>
impl<T: Copy> Copy for PatchValue<T>
Source§impl<T: Debug> Debug for PatchValue<T>
impl<T: Debug> Debug for PatchValue<T>
Source§impl<T> Default for PatchValue<T>
impl<T> Default for PatchValue<T>
Source§impl<'de, T> Deserialize<'de> for PatchValue<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for PatchValue<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 PatchValue<T>
Source§impl<T> From<Option<T>> for PatchValue<T>
impl<T> From<Option<T>> for PatchValue<T>
Source§impl<T: PartialEq> PartialEq for PatchValue<T>
impl<T: PartialEq> PartialEq for PatchValue<T>
Source§impl<T> Serialize for PatchValue<T>where
T: Serialize,
impl<T> Serialize for PatchValue<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for PatchValue<T>
Auto Trait Implementations§
impl<T> Freeze for PatchValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for PatchValue<T>where
T: RefUnwindSafe,
impl<T> Send for PatchValue<T>where
T: Send,
impl<T> Sync for PatchValue<T>where
T: Sync,
impl<T> Unpin for PatchValue<T>where
T: Unpin,
impl<T> UnsafeUnpin for PatchValue<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for PatchValue<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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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