Trait value_trait::Object
source · [−]pub trait Object {
type Key;
type Element;
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Element>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord;
fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut Self::Element>
where
Self::Key: Borrow<Q> + Hash + Eq,
Q: Hash + Eq + Ord;
fn insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Element>
where
K: Into<Self::Key>,
V: Into<Self::Element>,
Self::Key: Hash + Eq;
fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<Self::Element>
where
Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord;
fn iter<'i>(
&'i self
) -> Box<dyn Iterator<Item = (&Self::Key, &Self::Element)> + 'i>;
fn keys<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Key> + 'i>;
fn values<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>;
fn len(&self) -> usize;
fn is_empty(&self) -> bool { ... }
}
Expand description
A JSON Object
Associated Types
Required methods
Gets a ref to a value based on a key, returns None
if the
current Value isn’t an Object or doesn’t contain the key
it was asked for.
Gets the value of a key as a mutable reference.
Inserts a value
Removes a value from the object
Iterates over the key value paris
Iterates over the values