pub enum JsonScalar {
Null,
Bool(bool),
Number(Number),
String(String),
Undefined,
}Expand description
A leaf JSON value reached by a dotted path.
Objects and arrays are not leaves. crate::JsonPaths walks them and
records only the scalars inside. Self::Undefined appears only in a
diff, for a path that exists on one side.
Integer 1 and decimal 1.0 compare equal. Two integers compare exactly,
so a pair of large integers that would collapse to the same float stay
different.
Variants§
Null
JSON null.
Bool(bool)
JSON true or false.
Number(Number)
JSON number.
String(String)
JSON string.
Undefined
The path is missing on this side of a diff.
Implementations§
Source§impl JsonScalar
impl JsonScalar
Sourcepub fn from_integer(value: i64) -> Self
pub fn from_integer(value: i64) -> Self
A JSON number from an integer.
Sourcepub fn from_float(value: f64) -> Option<Self>
pub fn from_float(value: f64) -> Option<Self>
A JSON number from a finite float.
Returns None for NaN and infinity, which are not JSON numbers.
Trait Implementations§
Source§impl Clone for JsonScalar
impl Clone for JsonScalar
Source§impl Debug for JsonScalar
impl Debug for JsonScalar
Source§impl Display for JsonScalar
impl Display for JsonScalar
Source§impl From<&str> for JsonScalar
impl From<&str> for JsonScalar
Source§impl From<String> for JsonScalar
impl From<String> for JsonScalar
Source§impl From<bool> for JsonScalar
impl From<bool> for JsonScalar
Auto Trait Implementations§
impl Freeze for JsonScalar
impl RefUnwindSafe for JsonScalar
impl Send for JsonScalar
impl Sync for JsonScalar
impl Unpin for JsonScalar
impl UnsafeUnpin for JsonScalar
impl UnwindSafe for JsonScalar
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