pub enum Maybe<T> {
Absent,
Null,
Value(T),
}Expand description
A field the contract lets a caller leave out and also lets be JSON null.
The contract keeps “absent” and “null” apart for an optional nullable field, and so does this type:
Absent is left out of a request, Null is sent as null, and a response field is Absent when the key is
missing. Wrap a value with Maybe::from(value) or value.into().
Variants§
Absent
The key is not there.
Null
The key is there and its value is null.
Value(T)
The key is there with a value.
Implementations§
Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Maybe<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Maybe<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<T> StructuralPartialEq for Maybe<T>
Auto Trait Implementations§
impl<T> Freeze for Maybe<T>where
T: Freeze,
impl<T> RefUnwindSafe for Maybe<T>where
T: RefUnwindSafe,
impl<T> Send for Maybe<T>where
T: Send,
impl<T> Sync for Maybe<T>where
T: Sync,
impl<T> Unpin for Maybe<T>where
T: Unpin,
impl<T> UnsafeUnpin for Maybe<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Maybe<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