#[non_exhaustive]pub enum DefaultValue {
Str(String),
Int(i64),
UInt(u64),
Float(f64),
Bool(bool),
Variant(RustIdent),
Empty,
}Expand description
The value that serde uses when a property is absent.
Lowered from the schema default and already checked against the field type.
The JSON value alone is not enough to write Rust. 1 is 1 for an integer
field and 1.0 for a number field. "active" is a string for a String
field and a variant path for an enum.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Str(String)
A string literal.
Int(i64)
An integer literal.
UInt(u64)
An unsigned integer literal.
An unsigned field takes this rather than Self::Int, which keeps a
negative value out and reaches the whole range of u64, above where
i64 stops.
Float(f64)
A floating-point literal.
Bool(bool)
A bool literal.
Variant(RustIdent)
A unit variant of a generated string enum, named by its identifier.
Empty
An empty collection, which Default::default() gives for both Vec and
HashMap.
Trait Implementations§
Source§impl Clone for DefaultValue
impl Clone for DefaultValue
Source§fn clone(&self) -> DefaultValue
fn clone(&self) -> DefaultValue
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 DefaultValue
impl Debug for DefaultValue
Source§impl PartialEq for DefaultValue
impl PartialEq for DefaultValue
impl StructuralPartialEq for DefaultValue
Auto Trait Implementations§
impl Freeze for DefaultValue
impl RefUnwindSafe for DefaultValue
impl Send for DefaultValue
impl Sync for DefaultValue
impl Unpin for DefaultValue
impl UnsafeUnpin for DefaultValue
impl UnwindSafe for DefaultValue
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