pub(crate) struct GrowingHashmapChar<ValueType> {
pub(crate) used: i32,
pub(crate) fill: i32,
pub(crate) mask: i32,
pub(crate) map: Option<Vec<GrowingHashmapMapElemChar<ValueType>>>,
}
Expand description
specialized hashmap to store user provided types this implementation relies on a couple of base assumptions in order to simplify the implementation
- the hashmap does not have an upper limit of included items
- the default value for the
ValueType
can be used as a dummy value to indicate an empty cell - elements can’t be removed
- only allocates memory on first write access. This improves performance for hashmaps that are never written to
Fields§
§used: i32
§fill: i32
§mask: i32
§map: Option<Vec<GrowingHashmapMapElemChar<ValueType>>>
Implementations§
source§impl<ValueType> GrowingHashmapChar<ValueType>
impl<ValueType> GrowingHashmapChar<ValueType>
pub(crate) fn get(&self, key: u32) -> ValueType
pub(crate) fn get_mut(&mut self, key: u32) -> &mut ValueType
pub(crate) fn allocate(&mut self)
sourcepub(crate) fn lookup(&self, key: u32) -> usize
pub(crate) fn lookup(&self, key: u32) -> usize
lookup key inside the hashmap using a similar collision resolution
strategy to CPython
and Ruby
pub(crate) fn grow(&mut self, min_used: i32)
Trait Implementations§
Auto Trait Implementations§
impl<ValueType> Freeze for GrowingHashmapChar<ValueType>
impl<ValueType> RefUnwindSafe for GrowingHashmapChar<ValueType>where
ValueType: RefUnwindSafe,
impl<ValueType> Send for GrowingHashmapChar<ValueType>where
ValueType: Send,
impl<ValueType> Sync for GrowingHashmapChar<ValueType>where
ValueType: Sync,
impl<ValueType> Unpin for GrowingHashmapChar<ValueType>where
ValueType: Unpin,
impl<ValueType> UnwindSafe for GrowingHashmapChar<ValueType>where
ValueType: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more