pub struct I64Set { /* private fields */ }Expand description
High-performance HashSet for i64 keys.
Uses the same optimizations as I64Map:
- i64::MIN as the in-table empty sentinel with that logical value out of band
- FxHash with pre-mixing (XOR>>16 before multiply) - 0 sequential collisions
- Backward-shift deletion (no tombstones)
Supports the full i64 value domain.
Implementations§
Source§impl I64Set
impl I64Set
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted
in the set. The collection may reserve more space to avoid frequent reallocations.
Sourcepub fn insert(&mut self, key: i64) -> bool
pub fn insert(&mut self, key: i64) -> bool
Insert a value into the set. Returns true if the value was newly inserted.
pub fn contains(&self, key: i64) -> bool
pub fn remove(&mut self, key: i64) -> bool
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the set to fit its current contents, releasing excess memory.
Call this after removing many entries to reclaim memory.
pub fn clear(&mut self)
pub fn iter(&self) -> impl Iterator<Item = i64> + '_
Trait Implementations§
Source§impl Extend<i64> for I64Set
impl Extend<i64> for I64Set
Source§fn extend<T: IntoIterator<Item = i64>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = i64>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<i64> for I64Set
impl FromIterator<i64> for I64Set
Auto Trait Implementations§
impl Freeze for I64Set
impl RefUnwindSafe for I64Set
impl Send for I64Set
impl Sync for I64Set
impl Unpin for I64Set
impl UnsafeUnpin for I64Set
impl UnwindSafe for I64Set
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