pub enum JsonValue {
Null,
Bool(bool),
Number(Number),
String(String),
Array(Vec<JsonValue>),
Object(IndexMap<String, JsonValue>),
}Variants§
Null
Bool(bool)
Number(Number)
String(String)
Array(Vec<JsonValue>)
Object(IndexMap<String, JsonValue>)
Implementations§
Source§impl JsonValue
impl JsonValue
pub const fn is_null(&self) -> bool
pub const fn is_bool(&self) -> bool
pub const fn is_number(&self) -> bool
pub const fn is_string(&self) -> bool
pub const fn is_array(&self) -> bool
pub const fn is_object(&self) -> bool
Sourcepub fn is_i64(&self) -> bool
pub fn is_i64(&self) -> bool
Returns true if the value is a number that can be represented as i64
Sourcepub fn is_u64(&self) -> bool
pub fn is_u64(&self) -> bool
Returns true if the value is a number that can be represented as u64
pub fn is_f64(&self) -> bool
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If the value is a Bool, returns the associated bool. Returns None otherwise.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If the value is a number, represent it as i64 if possible. Returns None otherwise.
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
If the value is a number, represent it as u64 if possible. Returns None otherwise.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
If the value is a number, represent it as f64 if possible. Returns None otherwise.
pub fn as_str(&self) -> Option<&str>
pub fn as_array(&self) -> Option<&Vec<JsonValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
pub fn as_object(&self) -> Option<&IndexMap<String, JsonValue>>
pub fn as_object_mut(&mut self) -> Option<&mut IndexMap<String, JsonValue>>
pub fn type_name(&self) -> &'static str
Trait Implementations§
Source§impl IntoJsonValue for &JsonValue
impl IntoJsonValue for &JsonValue
fn into_json_value(self) -> JsonValue
Source§impl IntoJsonValue for JsonValue
impl IntoJsonValue for JsonValue
fn into_json_value(self) -> JsonValue
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 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