pub enum Undefinable<T> {
Undefined,
Null,
Value(T),
}Expand description
GraphQL nullable-input tri-state: absent (leave unchanged) / null
(clear) / value (set).
Input convention across this crate: create inputs use Option<T> with
#[serde(skip_serializing_if = "Option::is_none")] (absent-when-None);
update inputs use Undefinable<T> for clearable fields, with
#[serde(skip_serializing_if = "Undefinable::is_undefined", default)] and
#[builder(default, into)].
Variants§
Undefined
Field is omitted from the request: leave unchanged.
Null
Field is sent as null: clear the value.
Value(T)
Field is sent with a concrete value: set it.
Implementations§
Source§impl<T> Undefinable<T>
impl<T> Undefinable<T>
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
true when the field should be omitted from serialization entirely.
Trait Implementations§
Source§impl<T: Clone> Clone for Undefinable<T>
impl<T: Clone> Clone for Undefinable<T>
Source§fn clone(&self) -> Undefinable<T>
fn clone(&self) -> Undefinable<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 moreSource§impl<T: Debug> Debug for Undefinable<T>
impl<T: Debug> Debug for Undefinable<T>
Source§impl<T> Default for Undefinable<T>
impl<T> Default for Undefinable<T>
Source§fn default() -> Undefinable<T>
fn default() -> Undefinable<T>
Returns the “default value” for a type. Read more
Source§impl<T> From<T> for Undefinable<T>
impl<T> From<T> for Undefinable<T>
Source§impl<T: PartialEq> PartialEq for Undefinable<T>
impl<T: PartialEq> PartialEq for Undefinable<T>
Source§fn eq(&self, other: &Undefinable<T>) -> bool
fn eq(&self, other: &Undefinable<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T: Serialize> Serialize for Undefinable<T>
impl<T: Serialize> Serialize for Undefinable<T>
impl<T: PartialEq> StructuralPartialEq for Undefinable<T>
Auto Trait Implementations§
impl<T> Freeze for Undefinable<T>where
T: Freeze,
impl<T> RefUnwindSafe for Undefinable<T>where
T: RefUnwindSafe,
impl<T> Send for Undefinable<T>where
T: Send,
impl<T> Sync for Undefinable<T>where
T: Sync,
impl<T> Unpin for Undefinable<T>where
T: Unpin,
impl<T> UnsafeUnpin for Undefinable<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Undefinable<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