pub struct AbseilHashTable<TKey, TValue, TConfig>{ /* private fields */ }Expand description
The Abseil hash table.
Implementations§
Source§impl<TKey, TValue, TConfig> AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> AbseilHashTable<TKey, TValue, TConfig>
Sourcepub fn new() -> Selfwhere
TConfig: Default,
pub fn new() -> Selfwhere
TConfig: Default,
Creates a new AbseilHashTable with the default configuration.
Sourcepub const fn with_config(config: TConfig) -> Self
pub const fn with_config(config: TConfig) -> Self
Creates a new AbseilHashTable with the specified configuration.
Sourcepub fn with_capacity_and_config(
capacity: Length,
config: TConfig,
) -> Result<Self, HashTableError>
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.
Sourcepub fn with_capacity(capacity: Length) -> Result<Self, HashTableError>where
TConfig: Default,
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.
Sourcepub const fn length(&self) -> Length
pub const fn length(&self) -> Length
Returns the length of the AbseilHashTable.
Sourcepub const fn capacity(&self) -> Length
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>
impl<TKey, TValue, TConfig> Clone for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue: Debug, TConfig> Debug for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue: Debug, TConfig> Debug for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> Default for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> Default for AbseilHashTable<TKey, TValue, TConfig>
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.
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>,
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>
impl<TKey, TValue, TConfig> Drop for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> Eq for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> Hash for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> Hash for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> ImmutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> ImmutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
Source§fn length(&self) -> Length
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
fn contains<Q>(&self, key: &Q) -> bool
Checks if the table contains the corresponding
key. Read moreSource§fn get<Q>(&self, key: &Q) -> Option<&TValue>
fn get<Q>(&self, key: &Q) -> Option<&TValue>
Checks if the table contains the corresponding
key, and if so then returns
the reference to the TValue, or None otherwise. Read moreSource§fn get_key_value<Q>(&self, key: &Q) -> Option<KVP<&TKey, &TValue>>
fn get_key_value<Q>(&self, key: &Q) -> Option<KVP<&TKey, &TValue>>
Checks if the table contains the corresponding
key, and if so then returns
the (&TKey, &TValue) pair or None otherwise. Read moreSource§impl<TKey, TValue, TConfig> MutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> MutableHashTable<TKey, TValue> for AbseilHashTable<TKey, TValue, TConfig>
Source§fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut TValue>
fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut TValue>
Checks if the table contains the corresponding
key, and if so then returns
a mutable reference to the TValue, or None otherwise. Read moreSource§fn get_key_value_mut<Q>(&mut self, key: &Q) -> Option<KVP<&TKey, &mut TValue>>
fn get_key_value_mut<Q>(&mut self, key: &Q) -> Option<KVP<&TKey, &mut TValue>>
Checks if the table contains the corresponding
key, and if so then returns
a mutable reference to the TValue, or None otherwise. Read moreSource§fn remove_entry<Q>(&mut self, key: &Q) -> Option<KVP<TKey, TValue>>
fn remove_entry<Q>(&mut self, key: &Q) -> Option<KVP<TKey, TValue>>
Removes entire entry from the table. Returns
(TKey, TValue) pair
for the matching key or None if there is no match. Read moreSource§fn try_insert_or_update_with<FAdd, FUpdate>(
&mut self,
key: TKey,
adder: FAdd,
updater: FUpdate,
) -> Result<&mut TValue, HashTableError>
fn try_insert_or_update_with<FAdd, FUpdate>( &mut self, key: TKey, adder: FAdd, updater: FUpdate, ) -> Result<&mut TValue, HashTableError>
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 moreSource§fn iter_mut<'a>(
&'a mut self,
) -> impl Iterator<Item = KVP<&'a TKey, &'a mut TValue>> + 'awhere
TKey: 'a,
TValue: 'a,
Self: 'a,
fn iter_mut<'a>(
&'a mut self,
) -> impl Iterator<Item = KVP<&'a TKey, &'a mut TValue>> + 'awhere
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>
fn insert(&mut self, key: TKey, value: TValue) -> Option<TValue>
Inserts given
(TKey, TValue) pair into the table. Read moreSource§fn try_insert(
&mut self,
key: TKey,
value: TValue,
) -> Result<Option<TValue>, HashTableError>
fn try_insert( &mut self, key: TKey, value: TValue, ) -> Result<Option<TValue>, HashTableError>
Tries to insert given
(TKey, TValue) pair into the table. Read moreSource§fn insert_or_update_with<FAdd, FUpdate>(
&mut self,
key: TKey,
adder: FAdd,
updater: FUpdate,
) -> &mut TValue
fn insert_or_update_with<FAdd, FUpdate>( &mut self, key: TKey, adder: FAdd, updater: FUpdate, ) -> &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 moreSource§fn remove<Q>(&mut self, key: &Q) -> Option<TValue>
fn remove<Q>(&mut self, key: &Q) -> Option<TValue>
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 moreSource§fn get_or_insert_default(&mut self, key: TKey) -> &mut TValuewhere
TValue: Default,
fn get_or_insert_default(&mut self, key: TKey) -> &mut TValuewhere
TValue: Default,
Retrieves an existing
TValue, or inserts a default one. Read moreSource§fn try_get_or_insert_default(
&mut self,
key: TKey,
) -> Result<&mut TValue, HashTableError>where
TValue: Default,
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 moreSource§fn get_or_insert(&mut self, key: TKey, value: TValue) -> &mut TValue
fn get_or_insert(&mut self, key: TKey, value: TValue) -> &mut TValue
Retrieves an existing
TValue, or inserts the passed one. Read moreSource§fn try_get_or_insert(
&mut self,
key: TKey,
value: TValue,
) -> Result<&mut TValue, HashTableError>
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 moreSource§impl<TKey, TValue, TConfig> PartialEq for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> PartialEq for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> ReprC for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> ReprC for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> Send for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> Serialize for AbseilHashTable<TKey, TValue, TConfig>
Available on crate feature serde only.
impl<TKey, TValue, TConfig> Serialize for AbseilHashTable<TKey, TValue, TConfig>
Available on crate feature
serde only.impl<TKey, TValue, TConfig> Sync for AbseilHashTable<TKey, TValue, TConfig>
Source§impl<TKey, TValue, TConfig> TryClone for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> TryClone for AbseilHashTable<TKey, TValue, TConfig>
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>
impl<TKey, TValue, TConfig> Unpin for AbseilHashTable<TKey, TValue, TConfig>
impl<TKey, TValue, TConfig> UnsafeUnpin for AbseilHashTable<TKey, TValue, TConfig>where
TConfig: UnsafeUnpin,
impl<TKey, TValue, TConfig> UnwindSafe for AbseilHashTable<TKey, TValue, TConfig>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more