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) -> Map
pub fn with_capacity(n: usize) -> Map
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
pub fn iter(&self) -> impl ExactSizeIterator
The entries, in order.
Sourcepub fn keys(&self) -> impl ExactSizeIterator + Clone
pub fn keys(&self) -> impl ExactSizeIterator + Clone
The keys, in order.
Sourcepub fn values(&self) -> impl ExactSizeIterator
pub fn values(&self) -> impl ExactSizeIterator
The values, in order.
Trait Implementations§
Source§impl<K> FromIterator<(K, Value)> for Map
impl<K> FromIterator<(K, Value)> for Map
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