Struct OccupiedEntry

Source
pub struct OccupiedEntry<'a, C: ?Sized> { /* private fields */ }

Implementations§

Source§

impl<'a, C: 'a + Entriable> OccupiedEntry<'a, C>

Source

pub fn key(&self) -> &usize

Gets a reference to the index of the entry.

Source

pub fn remove_entry(self) -> (usize, C::T)

Take the ownership of the index and value from the container.

Source

pub fn get(&self) -> &C::T

Gets a reference to the value in the entry.

Source

pub fn get_mut(&mut self) -> &mut C::T

Gets a mutable reference to the value in the entry.

If you need a reference to the OccupiedEntry which may outlive the destruction of the Entry value, see into_mut.

Source

pub fn into_mut(self) -> &'a mut C::T

Converts the OccupiedEntry into a mutable reference to the value in the entry with a lifetime bound to the map itself.

If you need multiple references to the OccupiedEntry, see get_mut.

Source

pub fn insert(&mut self, value: C::T) -> C::T

Sets the value of the entry, and returns the entry’s old value.

Source

pub fn remove(self) -> C::T

Takes the value out of the entry, and returns it. Keeps the allocated memory for reuse.

Source

pub fn replace_entry(self, value: C::T) -> (usize, C::T)

Replaces the entry, returning the index and value.

Source

pub fn replace_entry_with<F, R>(self, f: F) -> (Entry<'a, C>, R)
where F: FnOnce(&usize, C::T) -> (Option<C::T>, R),

Provides shared access to the key and owned access to the value of the entry and allows to replace or remove it based on the value of the returned option.

Auto Trait Implementations§

§

impl<'a, C> Freeze for OccupiedEntry<'a, C>
where C: ?Sized,

§

impl<'a, C> RefUnwindSafe for OccupiedEntry<'a, C>
where C: RefUnwindSafe + ?Sized,

§

impl<'a, C> Send for OccupiedEntry<'a, C>
where C: Send + ?Sized,

§

impl<'a, C> Sync for OccupiedEntry<'a, C>
where C: Sync + ?Sized,

§

impl<'a, C> Unpin for OccupiedEntry<'a, C>
where C: ?Sized,

§

impl<'a, C> !UnwindSafe for OccupiedEntry<'a, C>

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

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.