[][src]Trait cuckoocache::bitpacked::FlagsT

pub trait FlagsT {
    const DEFAULT: bool;

    fn new(size: usize) -> Self;
fn setup(&mut self, b: usize);
fn bit_set(&mut self, s: usize);
fn bit_unset(&mut self, s: usize);
fn bit_set_to(&mut self, s: usize, discardable: bool);
fn bit_is_set(&self, s: usize) -> bool; }

Associated Constants

const DEFAULT: bool

Loading content...

Required methods

fn new(size: usize) -> Self

constructor creates memory to sufficiently keep track of garbage collection information for size entries.

Arguments

  • size the number of elements to allocate space for

Postconditions

  • bit_set, bit_unset, and bit_is_set function properly forall x. x < size.
  • All calls to bit_is_set (without subsequent bit_unset) will return Self::DEFAULT.

fn setup(&mut self, b: usize)

setup marks all entries and ensures that bit_packed_atomic_flags can store at least size entries

Arguments

  • b the number of elements to allocate space for

Postconditions

  • bit_set, bit_unset, and bit_is_set function properly forall x. x < b
  • All calls to bit_is_set (without subsequent bit_unset) will return Self::DEFAULT.

fn bit_set(&mut self, s: usize)

bit_set sets an entry as discardable.

Arguments

  • s the index of the entry to bit_set

Postconditions

  • immediately subsequent call (assuming proper external memory ordering) to bit_is_set(s) == true.

fn bit_unset(&mut self, s: usize)

bit_unset marks an entry as something that should not be overwritten

Arguments

  • s the index of the entry to bit_unset

Postconditions

  • immediately subsequent call (assuming proper external memory ordering) to bit_is_set(s) == false.

fn bit_set_to(&mut self, s: usize, discardable: bool)

bit_set_to sets an entry as specified.

Arguments

  • s the index of the entry to modify
  • discardable true does unset, false does set

Postconditions

  • immediately subsequent call (assuming proper external memory ordering) to bit_is_set(s) == true.

fn bit_is_set(&self, s: usize) -> bool

Loading content...

Implementors

impl FlagsT for cuckoocache::bitpacked::atomic::Flags[src]

impl FlagsT for cuckoocache::bitpacked::non_atomic::Flags[src]

Loading content...