pub enum ScalarValue<'de> {
Null,
Bool(bool),
Char(char),
I64(i64),
U64(u64),
I128(i128),
U128(u128),
F64(f64),
Str(Cow<'de, str>),
Bytes(Cow<'de, [u8]>),
StringlyTyped(Cow<'de, str>),
}Expand description
Scalar data extracted from the wire format.
Variants§
Null
Null literal.
Bool(bool)
Boolean literal.
Char(char)
Character literal.
I64(i64)
Signed integer literal (fits in i64).
U64(u64)
Unsigned integer literal (fits in u64).
I128(i128)
Signed 128-bit integer literal.
U128(u128)
Unsigned 128-bit integer literal.
F64(f64)
Floating-point literal.
Str(Cow<'de, str>)
UTF-8 string literal (definitely a string, not a number).
Bytes(Cow<'de, [u8]>)
Binary literal.
StringlyTyped(Cow<'de, str>)
Stringly-typed value from formats like XML where all values are text.
Unlike Str, this value’s type is ambiguous - it could be a number,
boolean, or actual string depending on the target type. The deserializer
will attempt to parse it according to the expected type.
Examples:
- XML
<value>42</value>→ StringlyTyped(“42”) → parses as i32, u64, String, etc. - XML
<value>2.5</value>→ StringlyTyped(“2.5”) → parses as f64, Decimal, String, etc. - JSON
"42"→ Str(“42”) → definitely a string, not a number
Trait Implementations§
Source§impl<'de> Clone for ScalarValue<'de>
impl<'de> Clone for ScalarValue<'de>
Source§fn clone(&self) -> ScalarValue<'de>
fn clone(&self) -> ScalarValue<'de>
Returns a duplicate 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<'de> Debug for ScalarValue<'de>
impl<'de> Debug for ScalarValue<'de>
Source§impl<'de> PartialEq for ScalarValue<'de>
impl<'de> PartialEq for ScalarValue<'de>
impl<'de> StructuralPartialEq for ScalarValue<'de>
Auto Trait Implementations§
impl<'de> Freeze for ScalarValue<'de>
impl<'de> RefUnwindSafe for ScalarValue<'de>
impl<'de> Send for ScalarValue<'de>
impl<'de> Sync for ScalarValue<'de>
impl<'de> Unpin for ScalarValue<'de>
impl<'de> UnwindSafe for ScalarValue<'de>
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