[][src]Struct ahtable::ArrayHashBuilder

pub struct ArrayHashBuilder<H> { /* fields omitted */ }

A builder that use for build an ArrayHash.

Implementations

impl<H> ArrayHashBuilder<H> where
    H: Hasher
[src]

pub fn with_hasher(hasher: H) -> ArrayHashBuilder<H>[src]

Create new ArrayHashBuilder by using given hasher. As currently is, the default allocated number of slot per bucket is (4096 / size of usize) slots.

Since all slots are Vec, it will be re-allocate if it grow larger than this default. However, number of slots per bucket will be constant. It will never grow pass this number.

pub fn hasher<H2>(self, hasher: H2) -> ArrayHashBuilder<H2>[src]

Switch hasher to other hasher. This will consume current builder and return a new one with new builder

pub fn buckets_size(self, size: usize) -> Self[src]

Change buckets size of ArrayHasher. Buckets size will remain constant throughout entire lifecycle of it.

pub fn max_load_factor(self, factor: usize) -> Self[src]

Change max number of entry before double the buckets size.

pub fn slot_size(self, size: usize) -> Self[src]

Default initialized slot size. Every slot in bucket will be allocated by given size. Keep in mind that each slot is a vec. It can grow pass this number. It'd be best to give a proper estimation to prevent unnecessary re-allocation.

pub fn build<K, V>(self) -> ArrayHash<H, K, V> where
    H: Hasher + Clone,
    K: Hash + PartialEq + Clone,
    V: Clone
[src]

Consume this builder and construct a new ArrayHash

Trait Implementations

impl Default for ArrayHashBuilder<XxHash64>[src]

Create new ArrayHashBuilder with default hasher and size. As currently is, the default allocated number of slot per bucket is (4096 / size of usize) slots. Each slot has 8 elements. It will use XxHash64 as default hasher

Since all slots are Vec, it will be re-allocate if it grow larger than this default. The number of slots per bucket will be held until the number of entry grew pass max_load_factor. When it reach the max_load_factor, it will double the bucket size.

Auto Trait Implementations

impl<H> RefUnwindSafe for ArrayHashBuilder<H> where
    H: RefUnwindSafe

impl<H> Send for ArrayHashBuilder<H> where
    H: Send

impl<H> Sync for ArrayHashBuilder<H> where
    H: Sync

impl<H> Unpin for ArrayHashBuilder<H> where
    H: Unpin

impl<H> UnwindSafe for ArrayHashBuilder<H> where
    H: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,