BitReclaimMap

Struct BitReclaimMap 

Source
pub struct BitReclaimMap<K: ?Sized + ToIndex, V, const N: usize> {
    map: IndexMap<K, V, N>,
    free: BitAlloc<N>,
}
Expand description

This is an IndexMap that additionally tracks which indices are occupied through a bitset.

Fields§

§map: IndexMap<K, V, N>§free: BitAlloc<N>

Implementations§

Source§

impl<K: ?Sized + ToIndex, V, const N: usize> BitReclaimMap<K, V, N>

Source

pub const fn new() -> Self

Source

pub fn insert(&mut self, value: V) -> Result<usize, Error>

Source

pub fn remove(&mut self, idx: &K) -> Option<V>

Source§

impl<K: Copy + ToIndex, V, const N: usize> BitReclaimMap<K, V, N>

Source

pub fn insert_with( &mut self, f: impl FnOnce(usize) -> Result<(K, V), Error>, ) -> Result<K, Error>

Trait Implementations§

Source§

impl<K: ?Sized + ToIndex, V, const N: usize> Get<K> for BitReclaimMap<K, V, N>

Source§

type Output = V

Source§

fn get<Q: Borrow<K>>(&self, index: Q) -> Option<&Self::Output>

Source§

impl<K: ?Sized + ToIndex, V, const N: usize> GetMut<K> for BitReclaimMap<K, V, N>

Source§

fn get_mut<Q: Borrow<K>>(&mut self, index: Q) -> Option<&mut Self::Output>

Source§

fn get2_mut<Q: Borrow<K>>( &mut self, index1: Q, index2: Q, ) -> (Option<&mut Self::Output>, Option<&mut Self::Output>)

Source§

fn get3_mut<Q: Borrow<K>>( &mut self, index1: Q, index2: Q, index3: Q, ) -> (Option<&mut Self::Output>, Option<&mut Self::Output>, Option<&mut Self::Output>)

Source§

impl<K: Copy + ToIndex, V, const N: usize> Index<K> for BitReclaimMap<K, V, N>

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, index: K) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<K: Copy + ToIndex, V, const N: usize> IndexMut<K> for BitReclaimMap<K, V, N>

Source§

fn index_mut(&mut self, index: K) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<K, V, const N: usize> Freeze for BitReclaimMap<K, V, N>
where V: Freeze, K: ?Sized,

§

impl<K, V, const N: usize> RefUnwindSafe for BitReclaimMap<K, V, N>

§

impl<K, V, const N: usize> !Send for BitReclaimMap<K, V, N>

§

impl<K, V, const N: usize> !Sync for BitReclaimMap<K, V, N>

§

impl<K, V, const N: usize> Unpin for BitReclaimMap<K, V, N>
where K: Unpin + ?Sized, V: Unpin,

§

impl<K, V, const N: usize> UnwindSafe for BitReclaimMap<K, V, N>
where K: UnwindSafe + ?Sized, V: UnwindSafe,

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.