pub struct VacantEntry<'map, Key, Value, State = RandomState> { /* private fields */ }
Expand description

A view into a vacant entry in the multimap.

Implementations§

source§

impl<'map, Key, Value, State> VacantEntry<'map, Key, Value, State>
where Key: Eq + Hash, State: BuildHasher,

source

pub fn insert(self, value: Value) -> &'map mut Value

§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();

let mut entry = match map.entry("key") {
    Entry::Vacant(entry) => entry,
    _ => panic!("expected vacant entry")
};

assert_eq!(entry.insert("value"), &"value");
source

pub fn insert_entry(self, value: Value) -> OccupiedEntry<'map, Key, Value>

§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map = ListOrderedMultimap::new();

let mut entry = match map.entry("key") {
    Entry::Vacant(entry) => entry,
    _ => panic!("expected vacant entry")
};

let mut entry = entry.insert_entry("value");
assert_eq!(entry.get(), &"value");
source

pub fn into_key(self) -> Key

§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map: ListOrderedMultimap<&str, &str> = ListOrderedMultimap::new();

let mut entry = match map.entry("key") {
    Entry::Vacant(entry) => entry,
    _ => panic!("expected vacant entry")
};

assert_eq!(entry.into_key(), "key");
source

pub fn key(&self) -> &Key

§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;

let mut map: ListOrderedMultimap<&str, &str> = ListOrderedMultimap::new();

let mut entry = match map.entry("key") {
    Entry::Vacant(entry) => entry,
    _ => panic!("expected vacant entry")
};

assert_eq!(entry.key(), &"key");

Trait Implementations§

source§

impl<Key, Value, State> Debug for VacantEntry<'_, Key, Value, State>
where Key: Debug,

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'map, Key, Value, State> Freeze for VacantEntry<'map, Key, Value, State>
where Key: Freeze,

§

impl<'map, Key, Value, State> RefUnwindSafe for VacantEntry<'map, Key, Value, State>
where Key: RefUnwindSafe, State: RefUnwindSafe, Value: RefUnwindSafe,

§

impl<'map, Key, Value, State> Send for VacantEntry<'map, Key, Value, State>
where Key: Send, State: Sync, Value: Send,

§

impl<'map, Key, Value, State> Sync for VacantEntry<'map, Key, Value, State>
where Key: Sync, State: Sync, Value: Sync,

§

impl<'map, Key, Value, State> Unpin for VacantEntry<'map, Key, Value, State>
where Key: Unpin,

§

impl<'map, Key, Value, State = RandomState> !UnwindSafe for VacantEntry<'map, Key, Value, State>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.