pub struct SparseObject { /* private fields */ }
Implementations§
Source§impl SparseObject
impl SparseObject
Sourcepub fn from_pairs<N: ToString, V: Into<Option<Value>>>(
iter: impl IntoIterator<Item = (N, V)>,
) -> SparseObject
pub fn from_pairs<N: ToString, V: Into<Option<Value>>>( iter: impl IntoIterator<Item = (N, V)>, ) -> SparseObject
Create a new sparse object from key-value pairs
Note: this method has two limitations:
- Shape created uses
AtMostOne
cardinality for all the elements. - There are no extra shape elements
Both of these are irrelevant when serializing the object.
Sourcepub fn empty() -> SparseObject
pub fn empty() -> SparseObject
Create an empty sparse object
pub fn pairs(&self) -> impl Iterator<Item = (&str, Option<&Value>)>
Trait Implementations§
Source§impl Clone for SparseObject
impl Clone for SparseObject
Source§fn clone(&self) -> SparseObject
fn clone(&self) -> SparseObject
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SparseObject
impl Debug for SparseObject
Source§impl PartialEq for SparseObject
impl PartialEq for SparseObject
Auto Trait Implementations§
impl Freeze for SparseObject
impl RefUnwindSafe for SparseObject
impl Send for SparseObject
impl Sync for SparseObject
impl Unpin for SparseObject
impl UnwindSafe for SparseObject
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