pub struct Map { /* private fields */ }Expand description
Keys are shared: a decoded document allocates each distinct key once, however many maps have it.
Implementations§
Source§impl Map
impl Map
Sourcepub fn with_capacity(n: usize) -> Self
pub fn with_capacity(n: usize) -> Self
An empty map with room for n entries.
Sourcepub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
pub fn insert(&mut self, key: impl Into<String>, value: Value) -> Option<Value>
Sets key, in place if it’s there, else at the end; returns the old value.
Sourcepub fn remove(&mut self, key: &str) -> Option<Value>
pub fn remove(&mut self, key: &str) -> Option<Value>
Takes key’s entry out: its value, the others keeping their order.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &Value)>
pub fn iter(&self) -> impl ExactSizeIterator<Item = (&str, &Value)>
The entries, in order.
Sourcepub fn keys(&self) -> impl ExactSizeIterator<Item = &str> + Clone
pub fn keys(&self) -> impl ExactSizeIterator<Item = &str> + Clone
The keys, in order.
Sourcepub fn values(&self) -> impl ExactSizeIterator<Item = &Value>
pub fn values(&self) -> impl ExactSizeIterator<Item = &Value>
The values, in order.
Trait Implementations§
Source§impl IntoIterator for Map
impl IntoIterator for Map
Auto Trait Implementations§
impl !Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnsafeUnpin for Map
impl UnwindSafe for Map
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