Skip to main content

VacantEntry

Struct VacantEntry 

Source
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 = RandomState> !UnwindSafe for VacantEntry<'map, Key, Value, State>

§

impl<'map, Key, Value, State> Freeze for VacantEntry<'map, Key, Value, State>
where &'map State: Freeze, Key: Freeze, &'map mut VecList<Key>: Freeze, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: Freeze, &'map mut VecList<ValueEntry<Key, Value>>: Freeze,

§

impl<'map, Key, Value, State> RefUnwindSafe for VacantEntry<'map, Key, Value, State>
where &'map State: RefUnwindSafe, Key: RefUnwindSafe, &'map mut VecList<Key>: RefUnwindSafe, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: RefUnwindSafe, &'map mut VecList<ValueEntry<Key, Value>>: RefUnwindSafe,

§

impl<'map, Key, Value, State> Send for VacantEntry<'map, Key, Value, State>
where &'map State: Send, Key: Send, &'map mut VecList<Key>: Send, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: Send, &'map mut VecList<ValueEntry<Key, Value>>: Send,

§

impl<'map, Key, Value, State> Sync for VacantEntry<'map, Key, Value, State>
where &'map State: Sync, Key: Sync, &'map mut VecList<Key>: Sync, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: Sync, &'map mut VecList<ValueEntry<Key, Value>>: Sync,

§

impl<'map, Key, Value, State> Unpin for VacantEntry<'map, Key, Value, State>
where &'map State: Unpin, Key: Unpin, &'map mut VecList<Key>: Unpin, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: Unpin, &'map mut VecList<ValueEntry<Key, Value>>: Unpin,

§

impl<'map, Key, Value, State> UnsafeUnpin for VacantEntry<'map, Key, Value, State>
where &'map State: UnsafeUnpin, Key: UnsafeUnpin, &'map mut VecList<Key>: UnsafeUnpin, &'map mut HashMap<Index<Key>, MapEntry<Key, Value>, DummyState>: UnsafeUnpin, &'map mut VecList<ValueEntry<Key, Value>>: UnsafeUnpin,

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

Source§

type Error = !

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

Source§

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.