[][src]Trait value_trait::Object

pub trait Object {
    type Key;
    type Element;
#[must_use]    pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Element>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
;
#[must_use] pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut Self::Element>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq + Ord
;
#[must_use] pub 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
;
#[must_use] pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<Self::Element>
    where
        Self::Key: Borrow<Q>,
        Q: Hash + Eq + Ord
;
#[must_use] pub fn iter<'i>(
        &'i self
    ) -> Box<dyn Iterator<Item = (&Self::Key, &Self::Element)> + 'i>;
#[must_use] pub fn keys<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Key> + 'i>;
#[must_use] pub fn values<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>;
#[must_use] pub fn len(&self) -> usize; #[must_use] pub fn is_empty(&self) -> bool { ... } }

A JSON Object

Associated Types

type Key[src]

The key in the objects

type Element[src]

The values in the object

Loading content...

Required methods

#[must_use]pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self::Element> where
    Self::Key: Borrow<Q> + Hash + Eq,
    Q: Hash + Eq + Ord
[src]

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.

#[must_use]pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut Self::Element> where
    Self::Key: Borrow<Q> + Hash + Eq,
    Q: Hash + Eq + Ord
[src]

Gets the value of a key as a mutable reference.

#[must_use]pub 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
[src]

Inserts a value

#[must_use]pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<Self::Element> where
    Self::Key: Borrow<Q>,
    Q: Hash + Eq + Ord
[src]

Removes a value from the object

#[must_use]pub fn iter<'i>(
    &'i self
) -> Box<dyn Iterator<Item = (&Self::Key, &Self::Element)> + 'i>
[src]

Iterates over the key value paris

#[must_use]pub fn keys<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Key> + 'i>[src]

Iterates over the keys

#[must_use]pub fn values<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>[src]

Iterates over the values

#[must_use]pub fn len(&self) -> usize[src]

Number of key/value pairs

Loading content...

Provided methods

#[must_use]pub fn is_empty(&self) -> bool[src]

Returns if the array is empty

Loading content...

Implementations on Foreign Types

impl<MapK, MapE> Object for Halfbrown<MapK, MapE> where
    MapK: Hash + Eq
[src]

type Key = MapK

type Element = MapE

impl<MapK, MapE, S: BuildHasher> Object for HashMap<MapK, MapE, S> where
    MapK: Hash + Eq
[src]

type Key = MapK

type Element = MapE

Loading content...

Implementors

Loading content...