pub struct AtomicBucket { /* private fields */ }
Expand description
Bucket implemented with an XOR atomic trick for sync.
Trait Implementations§
Source§impl Debug for AtomicBucket
impl Debug for AtomicBucket
Source§impl Default for AtomicBucket
impl Default for AtomicBucket
Source§fn default() -> AtomicBucket
fn default() -> AtomicBucket
Source§impl TwoBucket for AtomicBucket
impl TwoBucket for AtomicBucket
Source§fn contains(&self, hash: HashKind) -> bool
fn contains(&self, hash: HashKind) -> bool
Returns true if this bucket has any entry which contains the given hash.
Source§fn store(&self, general_entry: Entry)
fn store(&self, general_entry: Entry)
Unconditionally store the entry in the general slot, without updating age.
Source§fn replace(&self, priority_entry: Entry, age: u8)
fn replace(&self, priority_entry: Entry, age: u8)
Unconditionally place the entry in the priority slot and update age.
Source§fn swap_replace(&self, priority_entry: Entry, age: u8)
fn swap_replace(&self, priority_entry: Entry, age: u8)
Move the existing priority entry to the general slot, then place the new priority entry into the priority slot and update age.
Source§fn replace_by<F>(&self, entry: Entry, age: u8, should_replace: F)
fn replace_by<F>(&self, entry: Entry, age: u8, should_replace: F)
Replaces the priority
slot if should_replace
returns true,
otherwise the general
slot is replaced.
§Example:
if should_replace { priority := entry } else { general := entry }
FnOnce signature:
should_replace(&new_entry, new_age, &existing_priority_entry, existing_age) -> bool
Source§fn swap_replace_by<F>(&self, entry: Entry, age: u8, should_replace: F)
fn swap_replace_by<F>(&self, entry: Entry, age: u8, should_replace: F)
If should_replace returns true, then swap_replace with the given entry.
Example:
if should_replace { general := priority priority := entry } else { general := entry }
FnOnce signature:
should_replace(&new_entry, new_age, &existing_priority_entry, existing_age) -> bool