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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more