simd_json::prelude

Trait 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>,
             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>, 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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,

Source§

type Key = MapK

Source§

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>, 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>, Q: Hash + Eq + Ord + ?Sized,

Source§

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

Source§

type Key = MapK

Source§

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>, 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>, Q: Hash + Eq + Ord + ?Sized,

Implementors§