Struct push_while_ref::HashMapChild [−][src]
Implementations
impl<'a, K, T> HashMapChild<'a, K, T> where
K: Hash + Eq + Clone,
T: StaticType,
[src]
K: Hash + Eq + Clone,
T: StaticType,
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
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]
K: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, K, T> Send for HashMapChild<'a, K, T> where
K: Send,
T: Send,
[src]
K: Send,
T: Send,
impl<'a, K, T> Sync for HashMapChild<'a, K, T> where
K: Sync,
T: Sync,
[src]
K: Sync,
T: Sync,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,