Struct indexmap::map::core::RefMut

source ·
struct RefMut<'a, K, V> {
    indices: &'a mut HashTable<usize>,
    entries: &'a mut Vec<Bucket<K, V>>,
}
Expand description

Mutable references to the parts of an IndexMapCore.

When using HashTable::find_entry, that takes hold of &mut indices, so we have to borrow our &mut entries separately, and there’s no way to go back to a &mut IndexMapCore. So this type is used to implement methods on the split references, and IndexMapCore can also call those to avoid duplication.

Fields§

§indices: &'a mut HashTable<usize>§entries: &'a mut Vec<Bucket<K, V>>

Implementations§

source§

impl<'a, K, V> RefMut<'a, K, V>

source

fn new( indices: &'a mut HashTable<usize>, entries: &'a mut Vec<Bucket<K, V>>, ) -> Self

source

fn reserve_entries(&mut self, additional: usize)

Reserve entries capacity, rounded up to match the indices

source

fn insert_unique( self, hash: HashValue, key: K, value: V, ) -> OccupiedEntry<'a, K, V>

Insert a key-value pair in entries, without checking whether it already exists.

source

fn shift_insert_unique( &mut self, index: usize, hash: HashValue, key: K, value: V, )

Insert a key-value pair in entries at a particular index, without checking whether it already exists.

source

fn shift_remove_index(&mut self, index: usize) -> Option<(K, V)>

Remove an entry by shifting all entries that follow it

source

fn shift_remove_finish(&mut self, index: usize) -> (K, V)

Remove an entry by shifting all entries that follow it

The index should already be removed from self.indices.

source

fn swap_remove_index(&mut self, index: usize) -> Option<(K, V)>

Remove an entry by swapping it with the last

source

fn swap_remove_finish(&mut self, index: usize) -> (K, V)

Finish removing an entry by swapping it with the last

The index should already be removed from self.indices.

source

fn decrement_indices(&mut self, start: usize, end: usize)

Decrement all indices in the range start..end.

The index start - 1 should not exist in self.indices. All entries should still be in their original positions.

source

fn increment_indices(&mut self, start: usize, end: usize)

Increment all indices in the range start..end.

The index end should not exist in self.indices. All entries should still be in their original positions.

source

fn move_index(&mut self, from: usize, to: usize)

source

fn swap_indices(&mut self, a: usize, b: usize)

Auto Trait Implementations§

§

impl<'a, K, V> Freeze for RefMut<'a, K, V>

§

impl<'a, K, V> RefUnwindSafe for RefMut<'a, K, V>

§

impl<'a, K, V> Send for RefMut<'a, K, V>
where K: Send, V: Send,

§

impl<'a, K, V> Sync for RefMut<'a, K, V>
where K: Sync, V: Sync,

§

impl<'a, K, V> Unpin for RefMut<'a, K, V>

§

impl<'a, K, V> !UnwindSafe for RefMut<'a, K, V>

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.