pub struct JsonArray { /* private fields */ }
Implementations§
source§impl JsonArray
impl JsonArray
sourcepub fn empty() -> JsonArray
pub fn empty() -> JsonArray
Creates an empty JSON array. This is useful for building a JSON array from scratch.
sourcepub fn from_string(json: &str) -> JsonArray
pub fn from_string(json: &str) -> JsonArray
Builds a JSONArray from a string
containing children that implement
JsonRetreive
§Arguments
json
— An owned string containing the JSON.
sourcepub fn get<T: JsonRetrieve>(&self, index: usize) -> Result<T, JsonParseError>
pub fn get<T: JsonRetrieve>(&self, index: usize) -> Result<T, JsonParseError>
Gets the object at the index as a type that implements JsonRetrieve.
§Arguments
index
— The index to retrieve from.
sourcepub fn map<T: JsonRetrieve>(&self) -> Result<Vec<T>, JsonParseError>
pub fn map<T: JsonRetrieve>(&self) -> Result<Vec<T>, JsonParseError>
Converts all elements of this JSONArray to a type that implements JsonRetrieve. Progagates errors if any child keys are invalid.
sourcepub fn map_drop<T: JsonRetrieve>(&self) -> Vec<T>
pub fn map_drop<T: JsonRetrieve>(&self) -> Vec<T>
Converts all elements of this JSONArray to a type that implements JsonRetrieve. Silently drops any invalid children.
Trait Implementations§
source§impl JsonRetrieve for JsonArray
impl JsonRetrieve for JsonArray
Auto Trait Implementations§
impl Freeze for JsonArray
impl RefUnwindSafe for JsonArray
impl Send for JsonArray
impl Sync for JsonArray
impl Unpin for JsonArray
impl UnwindSafe for JsonArray
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
Mutably borrows from an owned value. Read more