Struct jsonc_parser::JsonObject
source · [−]pub struct JsonObject<'a>(_);
Expand description
A JSON object.
Implementations
sourceimpl<'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
sourceimpl<'a> Clone for JsonObject<'a>
impl<'a> Clone for JsonObject<'a>
sourcefn clone(&self) -> JsonObject<'a>
fn clone(&self) -> JsonObject<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for JsonObject<'a>
impl<'a> Debug for JsonObject<'a>
sourceimpl<'a> From<HashMap<String, JsonValue<'a>, RandomState>> for JsonObject<'a>
impl<'a> From<HashMap<String, JsonValue<'a>, RandomState>> for JsonObject<'a>
sourceimpl<'a> IntoIterator for JsonObject<'a>
impl<'a> IntoIterator for JsonObject<'a>
sourceimpl<'a> PartialEq<JsonObject<'a>> for JsonObject<'a>
impl<'a> PartialEq<JsonObject<'a>> for JsonObject<'a>
sourcefn eq(&self, other: &JsonObject<'a>) -> bool
fn eq(&self, other: &JsonObject<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &JsonObject<'a>) -> bool
fn ne(&self, other: &JsonObject<'a>) -> bool
This method tests for !=
.
impl<'a> StructuralPartialEq for JsonObject<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for JsonObject<'a>
impl<'a> Send for JsonObject<'a>
impl<'a> Sync for JsonObject<'a>
impl<'a> Unpin for JsonObject<'a>
impl<'a> UnwindSafe for JsonObject<'a>
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