Skip to main content

AbseilHashTable

Struct AbseilHashTable 

Source
pub struct AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig,
{ /* private fields */ }
Expand description

The Abseil hash table.

Implementations§

Source§

impl<TKey, TValue, TConfig> AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig,

Source

pub fn new() -> Self
where TConfig: Default,

Creates a new AbseilHashTable with the default configuration.

Source

pub const fn with_config(config: TConfig) -> Self

Creates a new AbseilHashTable with the specified configuration.

Source

pub fn with_capacity_and_config( capacity: Length, config: TConfig, ) -> Result<Self, HashTableError>

Creates a new AbseilHashTable with the specified configuration and capacity.

§Errors

For details see HashTableError.

Source

pub fn with_capacity(capacity: Length) -> Result<Self, HashTableError>
where TConfig: Default,

Creates a new AbseilHashTable with the capacity and default configuration.

§Errors

For details see HashTableError.

Source

pub const fn length(&self) -> Length

Returns the length of the AbseilHashTable.

Source

pub const fn capacity(&self) -> Length

Returns the capacity of the AbseilHashTable.

Trait Implementations§

Source§

impl<TKey, TValue, TConfig> Clone for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + TryClone, TValue: TryClone, TConfig: AbseilConfig + TryClone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<TKey, TValue: Debug, TConfig> Debug for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + Debug, TConfig: AbseilConfig + Debug,

Source§

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

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

impl<TKey, TValue, TConfig> Default for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig + Default,

Source§

fn default() -> Self

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

impl<'de, TKey, TValue, TConfig> Deserialize<'de> for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + Deserialize<'de>, TValue: Deserialize<'de>, TConfig: AbseilConfig + Default,

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<TKey, TValue, TConfig> Drop for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig,

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
Source§

impl<TKey, TValue, TConfig> Eq for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TValue: Eq, TConfig: AbseilConfig,

Source§

impl<TKey, TValue, TConfig> Hash for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TValue: Hash, TConfig: AbseilConfig,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<TKey, TValue, TConfig> ImmutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig,

Source§

fn length(&self) -> Length

Returns the number of (TKey, TValue) pairs the table contains. This typically does not correspond to the actual size of the table in bytes.
Source§

fn contains<Q>(&self, key: &Q) -> bool
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Checks if the table contains the corresponding key. Read more
Source§

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

Checks if the table contains the corresponding key, and if so then returns the reference to the TValue, or None otherwise. Read more
Source§

fn get_key_value<Q>(&self, key: &Q) -> Option<KVP<&TKey, &TValue>>
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Checks if the table contains the corresponding key, and if so then returns the (&TKey, &TValue) pair or None otherwise. Read more
Source§

fn iter<'a>(&'a self) -> impl Iterator<Item = KVP<&'a TKey, &'a TValue>>
where TKey: 'a, TValue: 'a, Self: 'a,

Returns an iterator over the key-value pairs in the table. Read more
Source§

fn is_empty(&self) -> bool

Checks if the table is empty. This does not mean that it doesn’t take space in memory. Equivalent to self.length() == 0 check.
Source§

impl<TKey, TValue, TConfig> MutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TConfig: AbseilConfig,

Source§

fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut TValue>
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Checks if the table contains the corresponding key, and if so then returns a mutable reference to the TValue, or None otherwise. Read more
Source§

fn get_key_value_mut<Q>(&mut self, key: &Q) -> Option<KVP<&TKey, &mut TValue>>
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Checks if the table contains the corresponding key, and if so then returns a mutable reference to the TValue, or None otherwise. Read more
Source§

fn remove_entry<Q>(&mut self, key: &Q) -> Option<KVP<TKey, TValue>>
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Removes entire entry from the table. Returns (TKey, TValue) pair for the matching key or None if there is no match. Read more
Source§

fn try_insert_or_update_with<FAdd, FUpdate>( &mut self, key: TKey, adder: FAdd, updater: FUpdate, ) -> Result<&mut TValue, HashTableError>
where FAdd: FnOnce() -> TValue, FUpdate: FnOnce(&mut TValue),

Searches the table for a given key. If the table contains it, then it runs updater on the corresponding TValue. Otherwise runs adder to add a new TValue to the table. Returns the mutable reference to the final TValue. Read more
Source§

fn iter_mut<'a>( &'a mut self, ) -> impl Iterator<Item = KVP<&'a TKey, &'a mut TValue>> + 'a
where TKey: 'a, TValue: 'a, Self: 'a,

Returns a mutable iterator over the key-value pairs in the table. Read more
Source§

fn insert(&mut self, key: TKey, value: TValue) -> Option<TValue>

Inserts given (TKey, TValue) pair into the table. Read more
Source§

fn try_insert( &mut self, key: TKey, value: TValue, ) -> Result<Option<TValue>, HashTableError>

Tries to insert given (TKey, TValue) pair into the table. Read more
Source§

fn insert_or_update_with<FAdd, FUpdate>( &mut self, key: TKey, adder: FAdd, updater: FUpdate, ) -> &mut TValue
where FAdd: FnOnce() -> TValue, FUpdate: FnOnce(&mut TValue),

Searches the table for a given key. If the table contains it, then it runs updater on the corresponding TValue. Otherwise runs adder to add a new TValue to the table. Returns the mutable reference to the final TValue. Read more
Source§

fn remove<Q>(&mut self, key: &Q) -> Option<TValue>
where TKey: Borrow<Q>, Q: Eq + Hash + ?Sized,

Removes entire entry from the table. Similar to MutableHashTable::remove_entry, but returns TValue only for the matching key or None if there is no match. Read more
Source§

fn get_or_insert_default(&mut self, key: TKey) -> &mut TValue
where TValue: Default,

Retrieves an existing TValue, or inserts a default one. Read more
Source§

fn try_get_or_insert_default( &mut self, key: TKey, ) -> Result<&mut TValue, HashTableError>
where TValue: Default,

Retrieves an existing TValue, or inserts a default one. Read more
Source§

fn get_or_insert(&mut self, key: TKey, value: TValue) -> &mut TValue

Retrieves an existing TValue, or inserts the passed one. Read more
Source§

fn try_get_or_insert( &mut self, key: TKey, value: TValue, ) -> Result<&mut TValue, HashTableError>

Retrieves an existing TValue, or inserts the passed one. Read more
Source§

impl<TKey, TValue, TConfig> PartialEq for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash, TValue: PartialEq, TConfig: AbseilConfig,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<TKey, TValue, TConfig> ReprC for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + ReprC, TValue: ReprC, TConfig: AbseilConfig + ReprC,

Source§

const CHECK: ()

This field is used for const checks only.
Source§

impl<TKey, TValue, TConfig> Send for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Send + Eq + Hash, TValue: Send, TConfig: AbseilConfig + Send,

Source§

impl<TKey, TValue, TConfig> Serialize for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + Serialize, TValue: Serialize, TConfig: AbseilConfig,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<TKey, TValue, TConfig> Sync for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Sync + Eq + Hash, TValue: Sync, TConfig: AbseilConfig + Sync,

Source§

impl<TKey, TValue, TConfig> TryClone for AbseilHashTable<TKey, TValue, TConfig>
where TKey: Eq + Hash + TryClone, TValue: TryClone, TConfig: AbseilConfig + TryClone,

Source§

type Error = TryCloneHashTableError

Source§

fn try_clone(&self) -> Result<Self, Self::Error>

Tries to clone the type. Read more

Auto Trait Implementations§

§

impl<TKey, TValue, TConfig> Freeze for AbseilHashTable<TKey, TValue, TConfig>
where TConfig: Freeze,

§

impl<TKey, TValue, TConfig> RefUnwindSafe for AbseilHashTable<TKey, TValue, TConfig>
where TConfig: RefUnwindSafe, TKey: RefUnwindSafe, TValue: RefUnwindSafe,

§

impl<TKey, TValue, TConfig> Unpin for AbseilHashTable<TKey, TValue, TConfig>
where TConfig: Unpin, TKey: Unpin, TValue: Unpin,

§

impl<TKey, TValue, TConfig> UnsafeUnpin for AbseilHashTable<TKey, TValue, TConfig>
where TConfig: UnsafeUnpin,

§

impl<TKey, TValue, TConfig> UnwindSafe for AbseilHashTable<TKey, TValue, TConfig>
where TConfig: UnwindSafe, TKey: UnwindSafe, TValue: 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.