pub struct JsonObject<'a>(/* private fields */);
Expand description
A JSON object.
Implementations§
Source§impl<'a> JsonObject<'a>
impl<'a> JsonObject<'a>
Sourcepub fn with_capacity(capacity: usize) -> JsonObject<'a>
pub fn with_capacity(capacity: usize) -> JsonObject<'a>
Creates a new JsonObject with the specified capacity.
Sourcepub fn take_inner(self) -> Map<String, JsonValue<'a>>
pub fn take_inner(self) -> Map<String, JsonValue<'a>>
Drops the object returning the inner 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> IntoIterator for JsonObject<'a>
impl<'a> IntoIterator for JsonObject<'a>
Source§impl<'a> PartialEq for JsonObject<'a>
impl<'a> PartialEq for JsonObject<'a>
impl<'a> StructuralPartialEq for JsonObject<'a>
Auto Trait Implementations§
impl<'a> Freeze for JsonObject<'a>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)