pub struct DenseHashSet<K, H = DenseHashDefault<K>, E = DenseEqDefault<K>> { /* private fields */ }Implementations§
Source§impl<K, H, E> DenseHashSet<K, H, E>
impl<K, H, E> DenseHashSet<K, H, E>
Sourcepub fn new(empty_key: K) -> Self
pub fn new(empty_key: K) -> Self
DenseHashSet(empty_key, buckets = 0). Reference: DenseHash.h:482-485.
Sourcepub fn insert(&mut self, key: K) -> &K
pub fn insert(&mut self, key: K) -> &K
insert — inserts key if absent and returns a reference to the stored
key. Reference: DenseHash.h:492-496.
Sourcepub fn find(&self, key: &K) -> Option<&K>
pub fn find(&self, key: &K) -> Option<&K>
const Key* find(const Key&) const. Reference: DenseHash.h:498-501.
Sourcepub fn get(&self, key: &K) -> Option<&K>
pub fn get(&self, key: &K) -> Option<&K>
std-style alias for generated Rust that spelled C++ find as get.
Sourcepub fn insert_mut(&mut self, key: K) -> &mut K
pub fn insert_mut(&mut self, key: K) -> &mut K
Mutable analogue of insert: inserts key if absent and returns a
mutable reference to the stored key. C++ insert returns const Key&
and callers reach for const_cast<Key&> when they need to fix up a
stored entry in place (e.g. AstNameTable::getOrAddWithType rewriting a
non-owned name pointer to an allocator-owned copy of the same bytes —
the hash/eq are unchanged so the slot stays valid). This exposes that
mutation soundly. Not a separate C++ method; the mutable access is the
faithful Rust spelling of the const_cast idiom.
Sourcepub fn iter(&self) -> ConstIterator<'_, K, K, ItemInterfaceSet<K>, H, E> ⓘ
pub fn iter(&self) -> ConstIterator<'_, K, K, ItemInterfaceSet<K>, H, E> ⓘ
begin()/end() iteration, yielding &Key.
Trait Implementations§
Source§impl<K: Debug, H, E> Debug for DenseHashSet<K, H, E>
impl<K: Debug, H, E> Debug for DenseHashSet<K, H, E>
Source§impl<K, H, E> Default for DenseHashSet<K, H, E>
C++ members declare their empty key inline (DenseHashSet<T> x{emptyT});
Rust #[derive(Default)] on containing structs needs this. The empty key
comes from the element’s DenseDefault sentinel.
impl<K, H, E> Default for DenseHashSet<K, H, E>
C++ members declare their empty key inline (DenseHashSet<T> x{emptyT});
Rust #[derive(Default)] on containing structs needs this. The empty key
comes from the element’s DenseDefault sentinel.
Source§impl<K, H, E> PartialEq for DenseHashSet<K, H, E>
operator== / operator!= — set equality. Reference: DenseHash.h:538-555.
impl<K, H, E> PartialEq for DenseHashSet<K, H, E>
operator== / operator!= — set equality. Reference: DenseHash.h:538-555.