Trait simd_json::prelude::Object[][src]

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

Prelude to include needed traits 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>(&self, k: &Q) -> Option<&Self::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[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>(&mut self, k: &Q) -> Option<&mut Self::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[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
    V: Into<Self::Element>,
    K: Into<Self::Key>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Inserts a value

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

Removes a value from the object

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

Iterates over the key value paris

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

Iterates over the keys

#[must_use]pub fn values(
    &'i self
) -> Box<dyn Iterator<Item = &'i Self::Element> + 'i, Global>
[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, S> Object for HashMap<MapK, MapE, S> where
    S: BuildHasher,
    MapK: Hash + Eq
[src]

type Key = MapK

type Element = MapE

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

type Key = MapK

type Element = MapE

Loading content...

Implementors

Loading content...