Struct spacetimedb_table::pointer_map::PointerMap
source · pub struct PointerMap { /* private fields */ }
Expand description
An pointer map RowHash -> [RowPointer]
.
Implementations§
source§impl PointerMap
impl PointerMap
sourcepub fn num_collisions(&self) -> usize
pub fn num_collisions(&self) -> usize
The number of colliding hashes in the map.
If two hashes collide then this counts as 2.
sourcepub fn num_non_collisions(&self) -> usize
pub fn num_non_collisions(&self) -> usize
The number hashes that do not collide.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of pointers in the map. This is equal to the number of non-colliding hashes plus the number of colliding hashes.
sourcepub fn pointers_for(&self, hash: RowHash) -> &[RowPointer]
pub fn pointers_for(&self, hash: RowHash) -> &[RowPointer]
Returns the row pointers associated with the given row hash
.
sourcepub fn pointers_for_mut(&mut self, hash: RowHash) -> &mut [RowPointer]
pub fn pointers_for_mut(&mut self, hash: RowHash) -> &mut [RowPointer]
Returns the row pointers associated with the given row hash
.
Take care not to change the reserved bit of any row pointer
or this will mess up the internal state of the PointerMap
.
sourcepub fn insert(&mut self, hash: RowHash, ptr: RowPointer) -> bool
pub fn insert(&mut self, hash: RowHash, ptr: RowPointer) -> bool
Associates row hash
with row ptr
.
Returns whether hash
was already associated with ptr
Handles any hash conflicts for hash
.
sourcepub fn remove(&mut self, hash: RowHash, ptr: RowPointer) -> bool
pub fn remove(&mut self, hash: RowHash, ptr: RowPointer) -> bool
Removes the association hash -> ptr
.
Returns whether the association was deleted.
Trait Implementations§
source§impl Clone for PointerMap
impl Clone for PointerMap
source§fn clone(&self) -> PointerMap
fn clone(&self) -> PointerMap
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PointerMap
impl Debug for PointerMap
source§impl Default for PointerMap
impl Default for PointerMap
source§fn default() -> PointerMap
fn default() -> PointerMap
Returns the “default value” for a type. Read more
source§impl FromIterator<(RowHash, RowPointer)> for PointerMap
impl FromIterator<(RowHash, RowPointer)> for PointerMap
source§fn from_iter<T: IntoIterator<Item = (RowHash, RowPointer)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (RowHash, RowPointer)>>(iter: T) -> Self
Creates a value from an iterator. Read more
source§impl PartialEq for PointerMap
impl PartialEq for PointerMap
source§fn eq(&self, other: &PointerMap) -> bool
fn eq(&self, other: &PointerMap) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for PointerMap
impl StructuralPartialEq for PointerMap
Auto Trait Implementations§
impl Freeze for PointerMap
impl RefUnwindSafe for PointerMap
impl Send for PointerMap
impl Sync for PointerMap
impl Unpin for PointerMap
impl UnwindSafe for PointerMap
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more