Struct jsonc_parser::JsonObject [−][src]
A JSON object.
Implementations
impl<'a> JsonObject<'a>
[src][−]
pub fn new(inner: HashMap<String, JsonValue<'a>>) -> JsonObject<'a>
[src][−]
Creates a new JsonObject.
pub fn take_inner(self) -> HashMap<String, JsonValue<'a>>
[src][−]
Drops the object returning the inner hash map.
pub fn len(&self) -> usize
[src][−]
Gets the number of properties.
pub fn get(&self, name: &str) -> Option<&JsonValue<'a>>
[src][−]
Gets a value in the object by its name.
pub fn get_string(&self, name: &str) -> Option<&Cow<'a, str>>
[src][−]
Gets a string property value from the object by name.
Returns None
when not a string or it doesn’t exist.
pub fn get_number(&self, name: &str) -> Option<&'a str>
[src][−]
Gets a number property value from the object by name.
Returns None
when not a number or it doesn’t exist.
pub fn get_boolean(&self, name: &str) -> Option<bool>
[src][−]
Gets a boolean property value from the object by name.
Returns None
when not a boolean or it doesn’t exist.
pub fn get_object(&self, name: &str) -> Option<&JsonObject<'a>>
[src][−]
Gets an object property value from the object by name.
Returns None
when not an object or it doesn’t exist.
pub fn get_array(&self, name: &str) -> Option<&JsonArray<'a>>
[src][−]
Gets an array property value from the object by name.
Returns None
when not an array or it doesn’t exist.
pub fn take(&mut self, name: &str) -> Option<JsonValue<'a>>
[src][−]
Takes a value from the object by name.
Returns None
when it doesn’t exist.
pub fn take_string(&mut self, name: &str) -> Option<Cow<'a, str>>
[src][−]
Takes a string property value from the object by name.
Returns None
when not a string or it doesn’t exist.
pub fn take_number(&mut self, name: &str) -> Option<&'a str>
[src][−]
Takes a number property value from the object by name.
Returns None
when not a number or it doesn’t exist.
pub fn take_boolean(&mut self, name: &str) -> Option<bool>
[src][−]
Takes a boolean property value from the object by name.
Returns None
when not a boolean or it doesn’t exist.
pub fn take_object(&mut self, name: &str) -> Option<JsonObject<'a>>
[src][−]
Takes an object property value from the object by name.
Returns None
when not an object or it doesn’t exist.
pub fn take_array(&mut self, name: &str) -> Option<JsonArray<'a>>
[src][−]
Takes an array property value from the object by name.
Returns None
when not an array or it doesn’t exist.
Trait Implementations
impl<'a> Clone for JsonObject<'a>
[src][+]
impl<'a> Debug for JsonObject<'a>
[src][+]
impl<'a> From<HashMap<String, JsonValue<'a>, RandomState>> for JsonObject<'a>
[src][+]
impl<'a> IntoIterator for JsonObject<'a>
[src][+]
impl<'a> PartialEq<JsonObject<'a>> for JsonObject<'a>
[src][+]
impl<'a> StructuralPartialEq for JsonObject<'a>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,