pub enum JsonValue {
Object(JsonObject),
Array(Vec<JsonValue>),
String(Vec<char>),
Number(NumberValue),
Boolean(bool),
Null,
}
Variants§
Implementations§
Source§impl 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.