AtomicBucket

Struct AtomicBucket 

Source
pub struct AtomicBucket { /* private fields */ }
Expand description

Bucket implemented with an XOR atomic trick for sync.

Trait Implementations§

Source§

impl Debug for AtomicBucket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AtomicBucket

Source§

fn default() -> AtomicBucket

Returns the “default value” for a type. Read more
Source§

impl TwoBucket for AtomicBucket

Source§

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)

Unconditionally store the entry in the general slot, without updating age.

Source§

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)

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)
where F: FnOnce(&Entry, u8, &Entry, u8) -> bool,

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)
where F: FnOnce(&Entry, u8, &Entry, u8) -> bool,

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

Source§

fn get(&self, hash: HashKind) -> Option<Entry>

Returns an entry if its corresponding hash exists in this bucket. If no entry’s hash matches the given hash, returns None.
Source§

fn len() -> usize

The number of entries held by this bucket.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V