pub enum Patch<T> {
Unchanged,
Clear,
Set(T),
}Expand description
One field’s requested change: leave it, clear it, or set it.
A three-state patch rather than Option<Option<T>> for the reason
crate::projects::Patch and crate::bulk::patch::PatchValue are: “the
caller did not mention this field” and “the caller asked to empty it” are
different requests, and an Option cannot tell them apart. Clearing an optional
field removes the key; clearing the required author produces an entry that
validation refuses by name, rather than a silent blank.
Variants§
Implementations§
Trait Implementations§
impl<T: Eq> Eq for Patch<T>
impl<T: PartialEq> StructuralPartialEq for Patch<T>
Auto Trait Implementations§
impl<T> Freeze for Patch<T>where
T: Freeze,
impl<T> RefUnwindSafe for Patch<T>where
T: RefUnwindSafe,
impl<T> Send for Patch<T>where
T: Send,
impl<T> Sync for Patch<T>where
T: Sync,
impl<T> Unpin for Patch<T>where
T: Unpin,
impl<T> UnsafeUnpin for Patch<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Patch<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<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