maglev

Struct Maglev

Source
pub struct Maglev<N, S = BuildHasherDefault<DefaultHasher>> { /* private fields */ }
Expand description

Maglev lookup table

Implementations§

Source§

impl<N: Hash + Eq> Maglev<N, BuildHasherDefault<DefaultHasher>>

Source

pub fn new<I: IntoIterator<Item = N>>(nodes: I) -> Self

Creates a Maglev lookup table.

Source

pub fn with_capacity<I: IntoIterator<Item = N>>( nodes: I, capacity: usize, ) -> Self

Creates a Maglev lookup table with the specified capacity.

Source§

impl<N: Hash + Eq, S: BuildHasher> Maglev<N, S>

Source

pub fn with_hasher<I: IntoIterator<Item = N>>(nodes: I, hash_builder: S) -> Self

Creates a Maglev lookup table which will use the given hash builder to hash keys.

Source

pub fn with_capacity_and_hasher<I: IntoIterator<Item = N>>( nodes: I, capacity: usize, hash_builder: S, ) -> Self

Creates a Maglev lookup table with the specified capacity, using hasher to hash the keys.

Trait Implementations§

Source§

impl<N: Clone, S: Clone> Clone for Maglev<N, S>

Source§

fn clone(&self) -> Maglev<N, S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N, S> ConsistentHasher<N> for Maglev<N, S>
where N: Hash + Eq, S: BuildHasher,

Source§

fn nodes(&self) -> &[N]

Returns all nodes in arbitrary order.
Source§

fn capacity(&self) -> usize

Returns the number of slots in the lookup table.
Source§

fn get<Q>(&self, key: &Q) -> Option<&N>
where Q: Hash + Eq + ?Sized,

Returns a reference to the node corresponding to the key.
Source§

impl<N: Debug, S: Debug> Debug for Maglev<N, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N: Hash + Eq> FromIterator<N> for Maglev<N, BuildHasherDefault<DefaultHasher>>

Source§

fn from_iter<T: IntoIterator<Item = N>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<N, S, Q> Index<&Q> for Maglev<N, S>
where N: Hash + Eq, S: BuildHasher, Q: Hash + Eq + ?Sized,

Source§

type Output = N

The returned type after indexing.
Source§

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

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

Auto Trait Implementations§

§

impl<N, S> Freeze for Maglev<N, S>
where S: Freeze,

§

impl<N, S> RefUnwindSafe for Maglev<N, S>

§

impl<N, S> Send for Maglev<N, S>
where S: Send, N: Send,

§

impl<N, S> Sync for Maglev<N, S>
where S: Sync, N: Sync,

§

impl<N, S> Unpin for Maglev<N, S>
where S: Unpin, N: Unpin,

§

impl<N, S> UnwindSafe for Maglev<N, S>
where S: UnwindSafe, N: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.