Struct jsonc_parser::JsonObject
source · pub struct JsonObject<'a>(_);
Expand description
A JSON object.
Implementations§
source§impl<'a> JsonObject<'a>
impl<'a> JsonObject<'a>
sourcepub fn take_inner(self) -> HashMap<String, JsonValue<'a>>
pub fn take_inner(self) -> HashMap<String, JsonValue<'a>>
Drops the object returning the inner hash map.
sourcepub fn get(&self, name: &str) -> Option<&JsonValue<'a>>
pub fn get(&self, name: &str) -> Option<&JsonValue<'a>>
Gets a value in the object by its name.
sourcepub fn get_string(&self, name: &str) -> Option<&Cow<'a, str>>
pub fn get_string(&self, name: &str) -> Option<&Cow<'a, str>>
Gets a string property value from the object by name.
Returns None
when not a string or it doesn’t exist.
sourcepub fn get_number(&self, name: &str) -> Option<&'a str>
pub fn get_number(&self, name: &str) -> Option<&'a str>
Gets a number property value from the object by name.
Returns None
when not a number or it doesn’t exist.
sourcepub fn get_boolean(&self, name: &str) -> Option<bool>
pub fn get_boolean(&self, name: &str) -> Option<bool>
Gets a boolean property value from the object by name.
Returns None
when not a boolean or it doesn’t exist.
sourcepub fn get_object(&self, name: &str) -> Option<&JsonObject<'a>>
pub fn get_object(&self, name: &str) -> Option<&JsonObject<'a>>
Gets an object property value from the object by name.
Returns None
when not an object or it doesn’t exist.
sourcepub fn get_array(&self, name: &str) -> Option<&JsonArray<'a>>
pub fn get_array(&self, name: &str) -> Option<&JsonArray<'a>>
Gets an array property value from the object by name.
Returns None
when not an array or it doesn’t exist.
sourcepub fn take(&mut self, name: &str) -> Option<JsonValue<'a>>
pub fn take(&mut self, name: &str) -> Option<JsonValue<'a>>
Takes a value from the object by name.
Returns None
when it doesn’t exist.
sourcepub fn take_string(&mut self, name: &str) -> Option<Cow<'a, str>>
pub fn take_string(&mut self, name: &str) -> Option<Cow<'a, str>>
Takes a string property value from the object by name.
Returns None
when not a string or it doesn’t exist.
sourcepub fn take_number(&mut self, name: &str) -> Option<&'a str>
pub fn take_number(&mut self, name: &str) -> Option<&'a str>
Takes a number property value from the object by name.
Returns None
when not a number or it doesn’t exist.
sourcepub fn take_boolean(&mut self, name: &str) -> Option<bool>
pub fn take_boolean(&mut self, name: &str) -> Option<bool>
Takes a boolean property value from the object by name.
Returns None
when not a boolean or it doesn’t exist.
sourcepub fn take_object(&mut self, name: &str) -> Option<JsonObject<'a>>
pub fn take_object(&mut self, name: &str) -> Option<JsonObject<'a>>
Takes an object property value from the object by name.
Returns None
when not an object or it doesn’t exist.
sourcepub fn take_array(&mut self, name: &str) -> Option<JsonArray<'a>>
pub fn take_array(&mut self, name: &str) -> Option<JsonArray<'a>>
Takes an array property value from the object by name.
Returns None
when not an array or it doesn’t exist.
Trait Implementations§
source§impl<'a> Clone for JsonObject<'a>
impl<'a> Clone for JsonObject<'a>
source§fn clone(&self) -> JsonObject<'a>
fn clone(&self) -> JsonObject<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for JsonObject<'a>
impl<'a> Debug for JsonObject<'a>
source§impl<'a> From<HashMap<String, JsonValue<'a>, RandomState>> for JsonObject<'a>
impl<'a> From<HashMap<String, JsonValue<'a>, RandomState>> for JsonObject<'a>
source§impl<'a> IntoIterator for JsonObject<'a>
impl<'a> IntoIterator for JsonObject<'a>
source§impl<'a> PartialEq<JsonObject<'a>> for JsonObject<'a>
impl<'a> PartialEq<JsonObject<'a>> for JsonObject<'a>
source§fn eq(&self, other: &JsonObject<'a>) -> bool
fn eq(&self, other: &JsonObject<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.