pub enum JsonValue {
Null,
Bool(bool),
Integer(i64),
Float(f64),
String(String),
Array(Vec<JsonValue>),
Object(Vec<(String, JsonValue)>),
}Expand description
A dynamic JSON value
Variants§
Null
Null value
Bool(bool)
Boolean value
Integer(i64)
Integer value (fits in i64)
Float(f64)
Floating point value
String(String)
String value
Array(Vec<JsonValue>)
Array of values
Object(Vec<(String, JsonValue)>)
Object (key-value pairs)
Implementations§
Source§impl JsonValue
impl JsonValue
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if value is an integer
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
Get as mutable array
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
pub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
Get mutable reference to a value from an object by key
Sourcepub fn into_string(self) -> Option<String>
pub fn into_string(self) -> Option<String>
Take ownership of a string value
Sourcepub fn into_array(self) -> Option<Vec<JsonValue>>
pub fn into_array(self) -> Option<Vec<JsonValue>>
Take ownership of an array value
Trait Implementations§
Source§impl<'de> JsonDeserialize<'de> for JsonValue
impl<'de> JsonDeserialize<'de> for JsonValue
Source§fn json_deserialize(parser: &mut JsonParser<'de>) -> Result<Self>
fn json_deserialize(parser: &mut JsonParser<'de>) -> Result<Self>
Deserialize a value from the given parser
Source§impl JsonSerialize for JsonValue
impl JsonSerialize for JsonValue
Source§fn json_serialize<W: Writer>(&self, writer: &mut JsonWriter<W>)
fn json_serialize<W: Writer>(&self, writer: &mut JsonWriter<W>)
Serialize this value to the given writer
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