pub enum JsonValue {
Object(JsonObject),
Array(Vec<JsonValue>),
String(Vec<char>),
Number(NumberValue),
Boolean(bool),
Null,
}
Variants
Object(JsonObject)
Array(Vec<JsonValue>)
String(Vec<char>)
Number(NumberValue)
Boolean(bool)
Null
Implementations
sourceimpl JsonValue
impl JsonValue
sourcepub fn is_object(&self) -> bool
pub fn is_object(&self) -> bool
Returns a boolean indicating whether this value is an object or not.
sourcepub fn as_object(&self) -> Option<&[(Vec<char>, JsonValue)]>
pub fn as_object(&self) -> Option<&[(Vec<char>, JsonValue)]>
Returns a reference to the key-value vec if this value is an object, otherwise returns None.
sourcepub fn to_object(self) -> Option<JsonObject>
pub fn to_object(self) -> Option<JsonObject>
Returns the wrapped object if the value is an object, otherwise returns None.
sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Returns a boolean indicating whether this value is an array or not.
sourcepub fn as_array(&self) -> Option<&[JsonValue]>
pub fn as_array(&self) -> Option<&[JsonValue]>
Returns a reference to the wrapped array if this value is an array, otherwise returns None.
sourcepub fn to_array(self) -> Option<Vec<JsonValue>>
pub fn to_array(self) -> Option<Vec<JsonValue>>
Returns the wrapped vector if the value is an array, otherwise returns None.
sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns a boolean indicating whether this value is a string or not.
sourcepub fn as_string(&self) -> Option<&[char]>
pub fn as_string(&self) -> Option<&[char]>
Returns a char slice if this value is a string, otherwise returns None.
sourcepub fn to_string(self) -> Option<Vec<char>>
pub fn to_string(self) -> Option<Vec<char>>
Returns the wrapped vector if the value is a string, otherwise returns None.
sourcepub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Returns a boolean indicating whether this value is a number or not.
sourcepub fn as_number(&self) -> Option<&NumberValue>
pub fn as_number(&self) -> Option<&NumberValue>
Returns a reference to wrapped NumberValue
if this value is a number, otherwise returns None.
sourcepub fn to_number(self) -> Option<NumberValue>
pub fn to_number(self) -> Option<NumberValue>
Returns the wrapped NumberValue if the value is a number, otherwise returns None.
sourcepub fn is_bool(&self) -> bool
pub fn is_bool(&self) -> bool
Returns a boolean indicating whether this value is a boolean or not.
sourcepub fn as_bool(&self) -> Option<&bool>
pub fn as_bool(&self) -> Option<&bool>
Returns a reference to the wrapped boolean if this value is a boolean, otherwise returns None.
Trait Implementations
impl StructuralPartialEq for JsonValue
Auto Trait Implementations
impl RefUnwindSafe for JsonValue
impl Send for JsonValue
impl Sync for JsonValue
impl Unpin for JsonValue
impl UnwindSafe for JsonValue
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more