Struct push_while_ref::HashMapChild[][src]

pub struct HashMapChild<'a, K, T>(_);

Implementations

impl<'a, K, T> HashMapChild<'a, K, T> where
    K: Hash + Eq + Clone,
    T: StaticType
[src]

pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

Returns true if the map contains a value for the specified key.

let mut map = HashMapOwner::new();
let mut map = map.child();
let value = map.insert("10".to_string(), Box::new(10));
assert!(map.contains_key("10"));

pub fn try_insert(&mut self, key: K, v: T) -> Option<&'a T::Ref>[src]

Tries to insert key and value if key already exists returns None

Else returns a reference to the inserted value without using the current lifetime

let mut map = HashMapOwner::new();
let mut map = map.child();
let v1 = map.try_insert("10", Box::new(10)).unwrap();
let v2 = map.try_insert("20", Box::new(20)).unwrap();
assert_eq!(*v1, 10);
assert_eq!(*v2, 20);

pub fn insert(&mut self, key: K, v: T) -> &'a T::Ref[src]

Insert key and value to the owner

Else returns a reference to the inserted value without using the current lifetime

Panics

Panics if key already exists

let mut map = HashMapOwner::new();
let mut map = map.child();
let v1 = map.insert("10", Box::new(10));
let v2 = map.insert("20", Box::new(20));
assert_eq!(*v1, 10);
assert_eq!(*v2, 20);

Trait Implementations

impl<'a, K: Debug, T: Debug> Debug for HashMapChild<'a, K, T>[src]

Auto Trait Implementations

impl<'a, K, T> RefUnwindSafe for HashMapChild<'a, K, T> where
    K: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<'a, K, T> Send for HashMapChild<'a, K, T> where
    K: Send,
    T: Send
[src]

impl<'a, K, T> Sync for HashMapChild<'a, K, T> where
    K: Sync,
    T: Sync
[src]

impl<'a, K, T> Unpin for HashMapChild<'a, K, T>[src]

impl<'a, K, T> !UnwindSafe for HashMapChild<'a, K, T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.