Trait simd_json::value::prelude::ObjectMut

source ·
pub trait ObjectMut {
    type Key: ?Sized;
    type Element;

    // Required methods
    fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Element>
       where Self::Key: Borrow<Q> + Hash + Eq,
             Q: Hash + Eq + Ord + ?Sized;
    fn insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Element>
       where Self::Key: From<K> + Hash + Eq,
             V: Into<Self::Element>;
    fn remove<Q>(&mut self, k: &Q) -> Option<Self::Element>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + Ord + ?Sized;
}
Expand description

A mutable value Object

Required Associated Types§

source

type Key: ?Sized

The key in the objects

source

type Element

The values in the object

Required Methods§

source

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

Gets the value of a key as a mutable reference.

source

fn insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Element>
where Self::Key: From<K> + Hash + Eq, V: Into<Self::Element>,

Inserts a value

source

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

Removes a value from the object

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<MapK, MapE, S> ObjectMut for HashMap<MapK, MapE, S>
where S: BuildHasher, MapK: Hash + Eq,

§

type Key = MapK

§

type Element = MapE

source§

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

source§

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

source§

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

source§

impl<MapK, MapE, S> ObjectMut for SizedHashMap<MapK, MapE, S>
where MapK: Hash + Eq, S: BuildHasher + Default,

§

type Key = MapK

§

type Element = MapE

source§

fn get_mut<Q>( &mut self, k: &Q ) -> Option<&mut <SizedHashMap<MapK, MapE, S> as ObjectMut>::Element>
where <SizedHashMap<MapK, MapE, S> as ObjectMut>::Key: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

source§

fn insert<K, V>( &mut self, k: K, v: V ) -> Option<<SizedHashMap<MapK, MapE, S> as ObjectMut>::Element>
where K: Into<<SizedHashMap<MapK, MapE, S> as ObjectMut>::Key>, V: Into<<SizedHashMap<MapK, MapE, S> as ObjectMut>::Element>, <SizedHashMap<MapK, MapE, S> as ObjectMut>::Key: Hash + Eq,

source§

fn remove<Q>( &mut self, k: &Q ) -> Option<<SizedHashMap<MapK, MapE, S> as ObjectMut>::Element>
where <SizedHashMap<MapK, MapE, S> as ObjectMut>::Key: Borrow<Q> + Hash + Eq, Q: Hash + Eq + Ord + ?Sized,

Implementors§