[][src]Trait bitvec::prelude::BitAccess

pub trait BitAccess<T>: Debug + Radium<T> + Sized where
    T: BitStore + BitOps + Sized
{ fn clear_bit<C>(&self, place: BitIdx<T>)
    where
        C: Cursor
, { ... }
fn clear_bits(&self, mask: T) { ... }
fn set_bit<C>(&self, place: BitIdx<T>)
    where
        C: Cursor
, { ... }
fn set_bits(&self, mask: T) { ... }
fn invert_bit<C>(&self, place: BitIdx<T>)
    where
        C: Cursor
, { ... }
fn get<C>(&self, place: BitIdx<T>) -> bool
    where
        C: Cursor
, { ... }
fn set<C>(&self, place: BitIdx<T>, value: bool)
    where
        C: Cursor
, { ... }
fn load(&self) -> T { ... }
fn store(&self, value: T) { ... }
unsafe fn as_slice_mut(this: &[Self]) -> &mut [T] { ... } }

Access interface for shared/mutable memory access.

&BitSlice and &mut BitSlice contexts must route through their Access associated type, which implements this trait, in order to perform any access to underlying memory. This trait extends the Radium element-wise shared mutable access with single-bit operations suited for use by BitSlice.

Provided methods

fn clear_bit<C>(&self, place: BitIdx<T>) where
    C: Cursor

Set a single bit in an element low.

BitAccess::set calls this when its value is false; it unconditionally writes a 0 bit into the electrical position that place controls according to the Cursor parameter C.

Type Parameters

  • C: A Cursor implementation which translates place into a usable bit-mask.

Parameters

  • &self: A shared reference to underlying memory.
  • place: A semantic bit index in the self element.

fn clear_bits(&self, mask: T)

Writes the low bits of the mask into the underlying element.

Parameters

  • &self
  • mask: Any value. The low bits of the mask will be written into *self; the high bits will preserve their value in *self.

fn set_bit<C>(&self, place: BitIdx<T>) where
    C: Cursor

Set a single bit in an element high.

BitAccess::set calls this when its value is true; it unconditionally writes a 1 bit into the electrical position that place controls according to the Cursor parameter C.

Type Parameters

  • C: A Cursor implementation which translates place into a usable bit-mask.

Parameters

  • &self: A shared reference to underlying memory.
  • place: A semantic bit index in the self element.

fn set_bits(&self, mask: T)

Writes the high bits of the mask into the underlying element.

Parameters

  • &self
  • mask: Any value. The high bits of the mask will be written into *self; the low bits will preserve their value in *self.

fn invert_bit<C>(&self, place: BitIdx<T>) where
    C: Cursor

Invert a single bit in an element.

Type Parameters

  • C: A Cursor implementation which translates place into a usable bit-mask.

Parameters

  • &self: A shared reference to underlying memory.
  • place: A semantic bit index in the self element.

fn get<C>(&self, place: BitIdx<T>) -> bool where
    C: Cursor

Retrieve a single bit from an element.

Type Parameters

  • C: A Cursor implementation which translates place into a usable bit-mask.

Parameters

  • &self: A shared reference to underlying memory.
  • place: A semantic bit index in the self element.

fn set<C>(&self, place: BitIdx<T>, value: bool) where
    C: Cursor

Set a single bit in an element to some value.

Type Parameters

  • C: A Cursor implementation which translates place into a usable bit-mask.

Parameters

  • &self: A shared reference to underlying memory.
  • place: A semantic bit index in the self element.
  • value: The value to which the bit controlled by place shall be set.

fn load(&self) -> T

Read a value out of a contended memory element and into a local scope.

Parameters

  • &self: A shared reference to underlying memory.

Returns

The value of *self. This value is only useful when access is uncontended by multiple BitSlice regions.

fn store(&self, value: T)

Stores a value into a contended memory element.

Parameters

  • &self: A shared reference to underlying memory.
  • value: The new value to write into *self.

unsafe fn as_slice_mut(this: &[Self]) -> &mut [T]

Converts a slice of BitAccess to a mutable slice of BitStore.

Safety

This can only be called on wholly owned, uncontended, regions.

Loading content...

Implementors

impl<T, R> BitAccess<T> for R where
    T: BitStore + BitOps,
    R: Debug + Radium<T>, 
[src]

Loading content...