Skip to main content

AssemblyHashMap

Struct AssemblyHashMap 

Source
pub struct AssemblyHashMap { /* private fields */ }
Expand description

Auto-growing u64 -> u64 map backed by fixed-capacity native tables.

The map owns its allocation. It is deliberately !Send and !Sync because the underlying implementation is specified as single-threaded.

Implementations§

Source§

impl AssemblyHashMap

Source

pub fn new() -> Self

Empty map with the smallest native table.

Source

pub fn with_capacity(minimum_capacity: usize) -> Result<Self, AllocError>

Allocates a map able to hold at least minimum_capacity live entries.

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, key: u64) -> Option<u64>

Equivalent to std::collections::HashMap::get(key).copied().

Source

pub fn contains_key(&self, key: u64) -> bool

Source

pub fn reserve(&mut self, additional: usize) -> Result<(), AllocError>

Ensures space for at least additional more elements.

Source

pub fn try_put( &mut self, key: u64, value: u64, ) -> Result<Option<u64>, AllocError>

Equivalent to HashMap::insert, growing in Rust when necessary.

Source

pub fn put(&mut self, key: u64, value: u64) -> Option<u64>

Equivalent to HashMap::insert; panics if native allocation fails.

Source

pub fn put_if_absent(&mut self, key: u64, value: u64) -> Option<u64>

Inserts only when absent, using one native probe.

Returns the existing value when no insertion occurred.

Source

pub fn get_or_insert(&mut self, key: u64, value: u64) -> u64

Returns the current value, inserting value with one probe if absent.

Source

pub fn replace(&mut self, key: u64, value: u64) -> Option<u64>

Replaces an existing value without inserting a missing key.

Source

pub fn remove(&mut self, key: u64) -> Option<u64>

Source

pub fn clear(&mut self)

Source

pub fn iter(&self) -> Iter<'_> ⓘ

Trait Implementations§

Source§

impl Debug for AssemblyHashMap

Source§

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

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

impl Default for AssemblyHashMap

Source§

fn default() -> Self

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

impl Drop for AssemblyHashMap

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.