strsim

Struct GrowingHashmapChar

source
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>
where ValueType: Default + Clone + Eq + Copy,

source

pub(crate) fn get(&self, key: u32) -> ValueType

source

pub(crate) fn get_mut(&mut self, key: u32) -> &mut ValueType

source

pub(crate) fn allocate(&mut self)

source

pub(crate) fn lookup(&self, key: u32) -> usize

lookup key inside the hashmap using a similar collision resolution strategy to CPython and Ruby

source

pub(crate) fn grow(&mut self, min_used: i32)

Trait Implementations§

source§

impl<ValueType> Default for GrowingHashmapChar<ValueType>
where ValueType: Default + Clone + Eq,

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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