pub struct Extensions { /* private fields */ }Expand description
Unmodelled fields, in serde_json::Map order.
Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn from_json_object(object: Map<String, Value>) -> Self
pub fn from_json_object(object: Map<String, Value>) -> Self
Builds a bag from a JSON object.
Sourcepub fn absorb_json(&mut self, object: &Map<String, Value>)
pub fn absorb_json(&mut self, object: &Map<String, Value>)
Merges a JSON object’s members in, keeping existing keys.
Sourcepub fn take(&mut self, key: &str) -> Option<ExtensionValue>
pub fn take(&mut self, key: &str) -> Option<ExtensionValue>
Removes a key and returns what was there.
Sourcepub fn to_json_object(&self) -> Map<String, Value>
pub fn to_json_object(&self) -> Map<String, Value>
Renders the bag back to a JSON object.
Source§impl Extensions
impl Extensions
Sourcepub fn with(self, key: impl Into<String>, value: ExtensionValue) -> Self
pub fn with(self, key: impl Into<String>, value: ExtensionValue) -> Self
Adds an entry, keeping insertion order and allowing duplicate keys.
Sourcepub fn insert(&mut self, key: impl Into<String>, value: ExtensionValue)
pub fn insert(&mut self, key: impl Into<String>, value: ExtensionValue)
Adds an entry in place.
Sourcepub fn get(&self, key: &str) -> Option<&ExtensionValue>
pub fn get(&self, key: &str) -> Option<&ExtensionValue>
The first value for key, or None.
“First” because duplicates are preserved, and the first is the one serde would have used.
Sourcepub fn get_all<'a>(
&'a self,
key: &'a str,
) -> impl Iterator<Item = &'a ExtensionValue>
pub fn get_all<'a>( &'a self, key: &'a str, ) -> impl Iterator<Item = &'a ExtensionValue>
Every value for key, in order.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &ExtensionValue)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &ExtensionValue)>
The entries, in order.
Sourcepub fn into_entries(self) -> Vec<(String, ExtensionValue)>
pub fn into_entries(self) -> Vec<(String, ExtensionValue)>
Consumes the bag, yielding its entries in order.
Trait Implementations§
Source§impl Clone for Extensions
impl Clone for Extensions
Source§impl Debug for Extensions
impl Debug for Extensions
Source§impl Default for Extensions
impl Default for Extensions
Source§impl Display for Extensions
impl Display for Extensions
Source§impl PartialEq for Extensions
impl PartialEq for Extensions
impl StructuralPartialEq for Extensions
Auto Trait Implementations§
impl Freeze for Extensions
impl RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl UnsafeUnpin for Extensions
impl UnwindSafe for Extensions
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