pub enum JsonValue {
String(String),
Integer(i64),
Float(f64),
Boolean(bool),
Null,
Array(JsonArray),
Object(JsonObject),
}Expand description
JSON value representation.
This represents the pure value of a JSON element without any source code location information.
Variants§
String(String)
String value.
Integer(i64)
Integer value.
Float(f64)
Floating-point value.
Boolean(bool)
Boolean value.
Null
Null value.
Array(JsonArray)
Array value.
Object(JsonObject)
Object value.
Implementations§
Source§impl JsonValue
impl JsonValue
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Returns the integer value if the value is an integer.
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Returns the floating-point value if the value is a float.
Sourcepub fn as_array(&self) -> Option<&Vec<JsonValue>>
pub fn as_array(&self) -> Option<&Vec<JsonValue>>
Returns a reference to the array if the value is an array.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonValue
impl<'de> Deserialize<'de> for JsonValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for JsonValue
Auto Trait Implementations§
impl Freeze for JsonValue
impl RefUnwindSafe for JsonValue
impl Send for JsonValue
impl Sync for JsonValue
impl Unpin for JsonValue
impl UnsafeUnpin for JsonValue
impl UnwindSafe for JsonValue
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