Skip to main content

SharedBitVec

Struct SharedBitVec 

Source
pub struct SharedBitVec { /* private fields */ }

Implementations§

Source§

impl SharedBitVec

Source

pub fn create( path: impl AsRef<Path>, capacity_bits: usize, ) -> Result<Self, BitVecError>

Source

pub fn open( path: impl AsRef<Path>, expected_capacity_bits: usize, ) -> Result<Self, BitVecError>

Source

pub fn capacity_bits(&self) -> usize

Source

pub fn capacity_words(&self) -> usize

Source

pub fn set(&self, i: usize) -> Result<bool, BitVecError>

Set bit i to 1. Returns the previous value at that bit.

Source

pub fn clear(&self, i: usize) -> Result<bool, BitVecError>

Clear bit i to 0. Returns the previous value at that bit.

Source

pub fn toggle(&self, i: usize) -> Result<bool, BitVecError>

Flip bit i. Returns the new value at that bit.

Source

pub fn get(&self, i: usize) -> Result<bool, BitVecError>

Read bit i.

Source

pub fn set_range(&self, lo: usize, hi: usize) -> Result<(), BitVecError>

Set all bits in lo..hi (exclusive end). Uses RMW on boundary words and unconditional store on interior words.

Source

pub fn clear_range(&self, lo: usize, hi: usize) -> Result<(), BitVecError>

Clear all bits in lo..hi (exclusive end). Same RMW-on- boundary, store-on-interior pattern.

Source

pub fn count_ones(&self) -> usize

Count total number of 1-bits across all words. O(words).

Source

pub fn count_zeros(&self) -> usize

Count total number of 0-bits in the valid range.

Source

pub fn is_all_set(&self) -> bool

Source

pub fn is_all_clear(&self) -> bool

Source

pub fn set_all(&self)

Set every bit. Unconditional Release-store on every word, with the last word masked to only valid bits so count_ones stays accurate.

Source

pub fn clear_all(&self)

Clear every bit.

Source

pub fn flush(&self) -> Result<(), BitVecError>

Source

pub fn flush_async(&self) -> Result<(), BitVecError>

Trait Implementations§

Source§

impl AdaptiveInstance for SharedBitVec

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

fn apply_migration(&self, new_tag: u32)

Called by the sidecar when the policy returns a new strategy tag. Default implementation: just set the tag on the header. Primitives that need heavier migration (data-layout swap) override this to perform the swap before (or after) updating the tag.
Source§

impl Send for SharedBitVec

Source§

impl Sync for SharedBitVec

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.