pub struct AtomicBitFieldVec<W: Word + IntoAtomic = usize, B = Vec<<W as IntoAtomic>::AtomicType>> { /* private fields */ }Expand description
A tentatively thread-safe vector of bit fields of fixed width (AKA “compact arrays“, “bit array“, etc.)
This implementation provides some concurrency guarantees, albeit not full-fledged thread safety: more precisely, we can guarantee thread-safety if the bit width is a power of two; otherwise, concurrent writes to values that cross word boundaries might end up in different threads succeeding in writing only part of a value. If the user can guarantee that no two threads ever write to the same boundary-crossing value, then no race condition can happen.
See the module documentation for more details.
Implementations§
Source§impl<W: Word + IntoAtomic, B> AtomicBitFieldVec<W, B>
impl<W: Word + IntoAtomic, B> AtomicBitFieldVec<W, B>
Sourcepub unsafe fn from_raw_parts(bits: B, bit_width: usize, len: usize) -> Self
pub unsafe fn from_raw_parts(bits: B, bit_width: usize, len: usize) -> Self
§Safety
len * bit_width must be between 0 (included) the number of
bits in bits (included).
pub fn into_raw_parts(self) -> (B, usize, usize)
Source§impl<W: Word + IntoAtomic, B: AsRef<[W::AtomicType]>> AtomicBitFieldVec<W, B>
impl<W: Word + IntoAtomic, B: AsRef<[W::AtomicType]>> AtomicBitFieldVec<W, B>
Sourcepub fn as_slice(&self) -> &[W::AtomicType]
pub fn as_slice(&self) -> &[W::AtomicType]
Returns the backend of the AtomicBitFieldVec as a slice of A, where A is the
atomic variant of W.
Source§impl<W: Word + IntoAtomic> AtomicBitFieldVec<W>where
W::AtomicType: AtomicUnsignedInt,
impl<W: Word + IntoAtomic> AtomicBitFieldVec<W>where
W::AtomicType: AtomicUnsignedInt,
pub fn new(bit_width: usize, len: usize) -> AtomicBitFieldVec<W>
Source§impl<W: Word + IntoAtomic, B: AsRef<[W::AtomicType]>> AtomicBitFieldVec<W, B>
impl<W: Word + IntoAtomic, B: AsRef<[W::AtomicType]>> AtomicBitFieldVec<W, B>
Trait Implementations§
Source§impl<W: Word + IntoAtomic, T: AsRef<[W::AtomicType]>> AtomicBitFieldSlice<W> for AtomicBitFieldVec<W, T>
impl<W: Word + IntoAtomic, T: AsRef<[W::AtomicType]>> AtomicBitFieldSlice<W> for AtomicBitFieldVec<W, T>
Source§fn set_atomic(&self, index: usize, value: W, order: Ordering)
fn set_atomic(&self, index: usize, value: W, order: Ordering)
Sets the element of the slice at the specified index.
May panic if the index is not in in [0..len)
or the value does not fit in BitWidth::bit_width bits.
Source§fn len(&self) -> usize
fn len(&self) -> usize
slice::len.Source§unsafe fn get_atomic_unchecked(&self, index: usize, order: Ordering) -> W
unsafe fn get_atomic_unchecked(&self, index: usize, order: Ordering) -> W
Source§unsafe fn set_atomic_unchecked(&self, index: usize, value: W, order: Ordering)
unsafe fn set_atomic_unchecked(&self, index: usize, value: W, order: Ordering)
Source§fn reset_atomic(&mut self, ordering: Ordering)
fn reset_atomic(&mut self, ordering: Ordering)
Source§fn par_reset_atomic(&mut self, ordering: Ordering)
fn par_reset_atomic(&mut self, ordering: Ordering)
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
slice::is_empty.Source§impl<W: Word + IntoAtomic, B> BitWidth<<W as IntoAtomic>::AtomicType> for AtomicBitFieldVec<W, B>
impl<W: Word + IntoAtomic, B> BitWidth<<W as IntoAtomic>::AtomicType> for AtomicBitFieldVec<W, B>
Source§impl<W: Clone + Word + IntoAtomic, B: Clone> Clone for AtomicBitFieldVec<W, B>
impl<W: Clone + Word + IntoAtomic, B: Clone> Clone for AtomicBitFieldVec<W, B>
Source§fn clone(&self) -> AtomicBitFieldVec<W, B>
fn clone(&self) -> AtomicBitFieldVec<W, B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<W, B> CopyType for AtomicBitFieldVec<W, B>
impl<W, B> CopyType for AtomicBitFieldVec<W, B>
Source§impl<W: Debug + Word + IntoAtomic, B: Debug> Debug for AtomicBitFieldVec<W, B>
impl<W: Debug + Word + IntoAtomic, B: Debug> Debug for AtomicBitFieldVec<W, B>
Source§impl<W: Word + IntoAtomic> From<AtomicBitFieldVec<W>> for BitFieldVec<W, Vec<W>>
impl<W: Word + IntoAtomic> From<AtomicBitFieldVec<W>> for BitFieldVec<W, Vec<W>>
Source§fn from(value: AtomicBitFieldVec<W, Vec<W::AtomicType>>) -> Self
fn from(value: AtomicBitFieldVec<W, Vec<W::AtomicType>>) -> Self
Source§impl<'a, W: Word + IntoAtomic> From<AtomicBitFieldVec<W, &'a [<W as IntoAtomic>::AtomicType]>> for BitFieldVec<W, &'a [W]>
impl<'a, W: Word + IntoAtomic> From<AtomicBitFieldVec<W, &'a [<W as IntoAtomic>::AtomicType]>> for BitFieldVec<W, &'a [W]>
Source§fn from(value: AtomicBitFieldVec<W, &'a [W::AtomicType]>) -> Self
fn from(value: AtomicBitFieldVec<W, &'a [W::AtomicType]>) -> Self
Source§impl<'a, W: Word + IntoAtomic> From<AtomicBitFieldVec<W, &'a mut [<W as IntoAtomic>::AtomicType]>> for BitFieldVec<W, &'a mut [W]>
impl<'a, W: Word + IntoAtomic> From<AtomicBitFieldVec<W, &'a mut [<W as IntoAtomic>::AtomicType]>> for BitFieldVec<W, &'a mut [W]>
Source§fn from(value: AtomicBitFieldVec<W, &'a mut [W::AtomicType]>) -> Self
fn from(value: AtomicBitFieldVec<W, &'a mut [W::AtomicType]>) -> Self
Source§impl<W: Word + IntoAtomic> From<AtomicBitFieldVec<W, Box<[<W as IntoAtomic>::AtomicType]>>> for BitFieldVec<W, Box<[W]>>
impl<W: Word + IntoAtomic> From<AtomicBitFieldVec<W, Box<[<W as IntoAtomic>::AtomicType]>>> for BitFieldVec<W, Box<[W]>>
Source§fn from(value: AtomicBitFieldVec<W, Box<[W::AtomicType]>>) -> Self
fn from(value: AtomicBitFieldVec<W, Box<[W::AtomicType]>>) -> Self
Source§impl<W: Word + IntoAtomic> From<BitFieldVec<W>> for AtomicBitFieldVec<W, Vec<W::AtomicType>>
impl<W: Word + IntoAtomic> From<BitFieldVec<W>> for AtomicBitFieldVec<W, Vec<W::AtomicType>>
Source§fn from(value: BitFieldVec<W, Vec<W>>) -> Self
fn from(value: BitFieldVec<W, Vec<W>>) -> Self
Source§impl<W: Word + IntoAtomic> From<BitFieldVec<W, Box<[W]>>> for AtomicBitFieldVec<W, Box<[W::AtomicType]>>
impl<W: Word + IntoAtomic> From<BitFieldVec<W, Box<[W]>>> for AtomicBitFieldVec<W, Box<[W::AtomicType]>>
Source§impl<W: Hash + Word + IntoAtomic, B: Hash> Hash for AtomicBitFieldVec<W, B>
impl<W: Hash + Word + IntoAtomic, B: Hash> Hash for AtomicBitFieldVec<W, B>
Source§impl<W, B> MemDbgImpl for AtomicBitFieldVec<W, B>
impl<W, B> MemDbgImpl for AtomicBitFieldVec<W, B>
fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, ) -> Result
fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, ) -> Result<(), Error>
Source§impl<W, B> MemSize for AtomicBitFieldVec<W, B>
impl<W, B> MemSize for AtomicBitFieldVec<W, B>
Source§impl<W: Word + IntoAtomic, T: AsRef<[W::AtomicType]>> SliceByValue for AtomicBitFieldVec<W, T>
impl<W: Word + IntoAtomic, T: AsRef<[W::AtomicType]>> SliceByValue for AtomicBitFieldVec<W, T>
Source§fn len(&self) -> usize
fn len(&self) -> usize
slice::len.Source§unsafe fn get_value_unchecked(&self, index: usize) -> Self::Value
unsafe fn get_value_unchecked(&self, index: usize) -> Self::Value
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
slice::is_empty.Source§fn index_value(&self, index: usize) -> Self::Value
fn index_value(&self, index: usize) -> Self::Value
Source§impl<'a, W: Word + IntoAtomic> TryFrom<BitFieldVec<W, &'a [W]>> for AtomicBitFieldVec<W, &'a [W::AtomicType]>
impl<'a, W: Word + IntoAtomic> TryFrom<BitFieldVec<W, &'a [W]>> for AtomicBitFieldVec<W, &'a [W::AtomicType]>
Source§impl<'a, W: Word + IntoAtomic> TryFrom<BitFieldVec<W, &'a mut [W]>> for AtomicBitFieldVec<W, &'a mut [W::AtomicType]>
impl<'a, W: Word + IntoAtomic> TryFrom<BitFieldVec<W, &'a mut [W]>> for AtomicBitFieldVec<W, &'a mut [W::AtomicType]>
Auto Trait Implementations§
impl<W, B> Freeze for AtomicBitFieldVec<W, B>
impl<W, B> RefUnwindSafe for AtomicBitFieldVec<W, B>where
B: RefUnwindSafe,
W: RefUnwindSafe,
impl<W, B> Send for AtomicBitFieldVec<W, B>where
B: Send,
impl<W, B> Sync for AtomicBitFieldVec<W, B>where
B: Sync,
impl<W, B> Unpin for AtomicBitFieldVec<W, B>
impl<W, B> UnwindSafe for AtomicBitFieldVec<W, B>where
B: UnwindSafe,
W: UnwindSafe,
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
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
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>
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>
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 moreSource§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
Source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
Source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>
core::fmt::Write debug infos about the structure memory
usage, expanding all levels of nested structures.Source§fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
mem_dbg, but expanding only up to max_depth
levels of nested structures.Source§fn mem_dbg_depth_on(
&self,
writer: &mut impl Write,
max_depth: usize,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>
core::fmt::Write debug infos about the structure memory
usage as mem_dbg_on, but expanding only up to
max_depth levels of nested structures.