[][src]Struct abi_stable::std_types::map::RVacantEntry

#[repr(C)]pub struct RVacantEntry<'a, K, V> { /* fields omitted */ }

A handle into a vacant entry in a map.

Implementations

impl<'a, K, V> RVacantEntry<'a, K, V>[src]

pub fn key(&self) -> &K[src]

Gets a reference to the key of the entry.

Example

use abi_stable::std_types::map::{REntry,RHashMap};

let mut map=RHashMap::<u32,u32>::new();

match map.entry(1337) {
    REntry::Occupied(_)=>{
        unreachable!();
    }
    REntry::Vacant(entry)=>{
        assert_eq!(entry.key(),&1337);
    }
}

assert_eq!( map.get(&1337), None );

pub fn into_key(self) -> K[src]

Gets back the key that was passed to RHashMap::entry.

Example

use abi_stable::std_types::map::{REntry,RHashMap};

let mut map=RHashMap::<String,u32>::new();

match map.entry("lol".into()) {
    REntry::Occupied(_)=>{
        unreachable!();
    }
    REntry::Vacant(entry)=>{
        assert_eq!(entry.into_key(),"lol".to_string());
    }
}

assert_eq!( map.get("lol"), None );

pub fn insert(self, value: V) -> &'a mut V[src]

Sets the value of the entry,returning a mutable reference to it.

Example

use abi_stable::std_types::map::{REntry,RHashMap};

let mut map=RHashMap::<String,u32>::new();

match map.entry("lol".into()) {
    REntry::Occupied(_)=>{
        unreachable!();
    }
    REntry::Vacant(entry)=>{
        assert_eq!(entry.insert(67),&mut 67);
    }
}

assert_eq!( map.get("lol"), Some(&67) );

Trait Implementations

impl<K, V> Debug for RVacantEntry<'_, K, V> where
    K: Debug
[src]

impl<'a, K, V> Drop for RVacantEntry<'a, K, V>[src]

impl<'a, K, V> GetStaticEquivalent_ for RVacantEntry<'a, K, V> where
    K: __StableAbi,
    V: __StableAbi,
    K: 'a,
    V: 'a, 
[src]

type StaticEquivalent = _static_RVacantEntry<'static, __GetStaticEquivalent<K>, __GetStaticEquivalent<V>>

impl<'a, K, V> StableAbi for RVacantEntry<'a, K, V> where
    K: __StableAbi,
    V: __StableAbi,
    K: 'a,
    V: 'a, 
[src]

type IsNonZeroType = False

Whether this type has a single invalid bit-pattern. Read more

Auto Trait Implementations

impl<'a, K, V> RefUnwindSafe for RVacantEntry<'a, K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<'a, K, V> Send for RVacantEntry<'a, K, V> where
    K: Send,
    V: Send
[src]

impl<'a, K, V> Sync for RVacantEntry<'a, K, V> where
    K: Sync,
    V: Sync
[src]

impl<'a, K, V> Unpin for RVacantEntry<'a, K, V> where
    K: Unpin
[src]

impl<'a, K, V> !UnwindSafe for RVacantEntry<'a, K, V>[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> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

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

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

impl<This> TransmuteElement for This where
    This: ?Sized
[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.

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

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

The error type returned when the conversion fails.

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

type Type = T

The same type as Self. Read more