pub enum FieldValue {
Absent,
Present(Value),
}Expand description
One side of a field change: absent, or an explicit JSON value.
Option<serde_json::Value> cannot express this: with
skip_serializing_if = "Option::is_none" an explicit Some(Value::Null) —
“this field is being cleared” — is written as a missing key and reads back
as None, so a review card that clears a field fails
Interaction::verify_payload_hash after a round trip through any JSON
store and its confirmation can never match. FieldValue keeps the two
apart: Self::Absent omits the key, Self::Present writes the value,
null included.
Variants§
Absent
The field is not part of this side of the change.
Present(Value)
An explicit value. serde_json::Value::Null means “cleared”.
Implementations§
Source§impl FieldValue
impl FieldValue
Sourcepub fn present(value: impl Into<Value>) -> FieldValue
pub fn present(value: impl Into<Value>) -> FieldValue
A present value.
Sourcepub fn cleared() -> FieldValue
pub fn cleared() -> FieldValue
An explicit JSON null: the field is being cleared.
Trait Implementations§
Source§impl Clone for FieldValue
impl Clone for FieldValue
Source§fn clone(&self) -> FieldValue
fn clone(&self) -> FieldValue
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 Debug for FieldValue
impl Debug for FieldValue
Source§impl Default for FieldValue
impl Default for FieldValue
Source§fn default() -> FieldValue
fn default() -> FieldValue
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for FieldValue
impl<'de> Deserialize<'de> for FieldValue
Source§fn deserialize<D>(
deserializer: D,
) -> Result<FieldValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<FieldValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FieldValue
Source§impl From<Value> for FieldValue
impl From<Value> for FieldValue
Source§fn from(value: Value) -> FieldValue
fn from(value: Value) -> FieldValue
Converts to this type from the input type.
Source§impl PartialEq for FieldValue
impl PartialEq for FieldValue
Source§impl Serialize for FieldValue
impl Serialize for FieldValue
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for FieldValue
Auto Trait Implementations§
impl Freeze for FieldValue
impl RefUnwindSafe for FieldValue
impl Send for FieldValue
impl Sync for FieldValue
impl Unpin for FieldValue
impl UnsafeUnpin for FieldValue
impl UnwindSafe for FieldValue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.