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

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

Prelude to include needed traits A JSON Object

Associated Types

type Key[src]

Expand description

The key in the objects

type Element[src]

Expand description

The values in the object

Loading content...

Required methods

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

Expand description

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]
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]

Expand description

Gets the value of a key as a mutable reference.

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

Expand description

Inserts a value

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

Expand description

Removes a value from the object

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

Expand description

Iterates over the key value paris

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

Expand description

Iterates over the keys

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

Expand description

Iterates over the values

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

Expand description

Number of key/value pairs

Loading content...

Provided methods

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

Expand description

Returns if the array is empty

Loading content...

Implementations on Foreign Types

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

type Key = MapK

type Element = MapE

pub fn get<Q>(
    &self,
    k: &Q
) -> Option<&<HashMap<MapK, MapE, RandomState> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Hash,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Eq
[src]

pub fn get_mut<Q>(
    &mut self,
    k: &Q
) -> Option<&mut <HashMap<MapK, MapE, RandomState> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Hash,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Eq
[src]

pub fn insert<K, V>(
    &mut self,
    k: K,
    v: V
) -> Option<<HashMap<MapK, MapE, RandomState> as Object>::Element> where
    V: Into<<HashMap<MapK, MapE, RandomState> as Object>::Element>,
    K: Into<<HashMap<MapK, MapE, RandomState> as Object>::Key>,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Hash,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Eq
[src]

pub fn remove<Q>(
    &mut self,
    k: &Q
) -> Option<<HashMap<MapK, MapE, RandomState> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Hash,
    <HashMap<MapK, MapE, RandomState> as Object>::Key: Eq
[src]

pub fn iter(
    &'i self
) -> Box<dyn Iterator<Item = (&'i <HashMap<MapK, MapE, RandomState> as Object>::Key, &'i <HashMap<MapK, MapE, RandomState> as Object>::Element)> + 'i, Global>
[src]

pub fn keys(
    &'i self
) -> Box<dyn Iterator<Item = &'i <HashMap<MapK, MapE, RandomState> as Object>::Key> + 'i, Global>
[src]

pub fn values(
    &'i self
) -> Box<dyn Iterator<Item = &'i <HashMap<MapK, MapE, RandomState> as Object>::Element> + 'i, Global>
[src]

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

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

type Key = MapK

type Element = MapE

pub fn get<Q>(
    &self,
    k: &Q
) -> Option<&<HashMap<MapK, MapE, S> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, S> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, S> as Object>::Key: Hash,
    <HashMap<MapK, MapE, S> as Object>::Key: Eq
[src]

pub fn get_mut<Q>(
    &mut self,
    k: &Q
) -> Option<&mut <HashMap<MapK, MapE, S> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, S> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, S> as Object>::Key: Hash,
    <HashMap<MapK, MapE, S> as Object>::Key: Eq
[src]

pub fn insert<K, V>(
    &mut self,
    k: K,
    v: V
) -> Option<<HashMap<MapK, MapE, S> as Object>::Element> where
    V: Into<<HashMap<MapK, MapE, S> as Object>::Element>,
    K: Into<<HashMap<MapK, MapE, S> as Object>::Key>,
    <HashMap<MapK, MapE, S> as Object>::Key: Hash,
    <HashMap<MapK, MapE, S> as Object>::Key: Eq
[src]

pub fn remove<Q>(
    &mut self,
    k: &Q
) -> Option<<HashMap<MapK, MapE, S> as Object>::Element> where
    Q: Hash + Eq + Ord + ?Sized,
    <HashMap<MapK, MapE, S> as Object>::Key: Borrow<Q>,
    <HashMap<MapK, MapE, S> as Object>::Key: Hash,
    <HashMap<MapK, MapE, S> as Object>::Key: Eq
[src]

pub fn iter(
    &'i self
) -> Box<dyn Iterator<Item = (&'i <HashMap<MapK, MapE, S> as Object>::Key, &'i <HashMap<MapK, MapE, S> as Object>::Element)> + 'i, Global>
[src]

pub fn keys(
    &'i self
) -> Box<dyn Iterator<Item = &'i <HashMap<MapK, MapE, S> as Object>::Key> + 'i, Global>
[src]

pub fn values(
    &'i self
) -> Box<dyn Iterator<Item = &'i <HashMap<MapK, MapE, S> as Object>::Element> + 'i, Global>
[src]

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

Loading content...

Implementors

Loading content...