arrow_select::dictionary

Struct Interner

Source
struct Interner<'a, V> {
    state: RandomState,
    buckets: Vec<Option<(&'a [u8], V)>>,
    shift: u32,
}
Expand description

A best effort interner that maintains a fixed number of buckets and interns keys based on their hash value

Hash collisions will result in replacement

Fields§

§state: RandomState§buckets: Vec<Option<(&'a [u8], V)>>§shift: u32

Implementations§

Source§

impl<'a, V> Interner<'a, V>

Source

fn new(capacity: usize) -> Self

Capacity controls the number of unique buckets allocated within the Interner

A larger capacity reduces the probability of hash collisions, and should be set based on an approximation of the upper bound of unique values

Source

fn intern<F: FnOnce() -> Result<V, E>, E>( &mut self, new: &'a [u8], f: F, ) -> Result<&V, E>

Auto Trait Implementations§

§

impl<'a, V> Freeze for Interner<'a, V>

§

impl<'a, V> RefUnwindSafe for Interner<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for Interner<'a, V>
where V: Send,

§

impl<'a, V> Sync for Interner<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for Interner<'a, V>
where V: Unpin,

§

impl<'a, V> UnwindSafe for Interner<'a, V>
where 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.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,