pub enum UpdateNonNullable<T> {
Keep,
Change(T),
}
Expand description
Clearer representation of an optional non-nullable field.
Requires #[serde(default, skip_serializing_if = "Update::is_keep")]
to be applied to
fields which use this type.
Variants§
Keep
Use the current value stored in the database. Equivalent of undefined
in JS.
Change(T)
Use the given value.
Implementations§
Source§impl<T> UpdateNonNullable<T>
impl<T> UpdateNonNullable<T>
Sourcepub fn into_option(self) -> Option<T>
pub fn into_option(self) -> Option<T>
Similar to Option<Option<T>>::flatten()
, this converts the variant into an Option<T>
.
Useful for coalesce updates.
Trait Implementations§
Source§impl<T: Clone> Clone for UpdateNonNullable<T>
impl<T: Clone> Clone for UpdateNonNullable<T>
Source§fn clone(&self) -> UpdateNonNullable<T>
fn clone(&self) -> UpdateNonNullable<T>
Returns a copy 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 UpdateNonNullable<T>
impl<T: Debug> Debug for UpdateNonNullable<T>
Source§impl<T> Default for UpdateNonNullable<T>
impl<T> Default for UpdateNonNullable<T>
Source§fn default() -> UpdateNonNullable<T>
fn default() -> UpdateNonNullable<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for UpdateNonNullable<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for UpdateNonNullable<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
Source§impl<T> From<Option<T>> for UpdateNonNullable<T>
impl<T> From<Option<T>> for UpdateNonNullable<T>
Auto Trait Implementations§
impl<T> Freeze for UpdateNonNullable<T>where
T: Freeze,
impl<T> RefUnwindSafe for UpdateNonNullable<T>where
T: RefUnwindSafe,
impl<T> Send for UpdateNonNullable<T>where
T: Send,
impl<T> Sync for UpdateNonNullable<T>where
T: Sync,
impl<T> Unpin for UpdateNonNullable<T>where
T: Unpin,
impl<T> UnwindSafe for UpdateNonNullable<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