Trait drone_core::bitfield::Bitfield[][src]

pub trait Bitfield: Sized + Send + Sync + Clone + Copy + 'static {
    type Bits: Bits;
    fn bits(&self) -> Self::Bits;
fn bits_mut(&mut self) -> &mut Self::Bits; unsafe fn read_bit(&self, offset: Self::Bits) -> bool { ... }
unsafe fn set_bit(&mut self, offset: Self::Bits) { ... }
unsafe fn clear_bit(&mut self, offset: Self::Bits) { ... }
unsafe fn toggle_bit(&mut self, offset: Self::Bits) { ... }
unsafe fn read_bits(
        &self,
        offset: Self::Bits,
        width: Self::Bits
    ) -> Self::Bits { ... }
unsafe fn write_bits(
        &mut self,
        offset: Self::Bits,
        width: Self::Bits,
        bits: Self::Bits
    ) { ... } }
[]

An integer value treated as a sequence of bits, which can be toggled individually.

See the module level documentation for more.

Associated Types

type Bits: Bits[src][]

The type of the integer. Determines the total number of bits.

Required methods

fn bits(&self) -> Self::Bits[src][]

Returns a copy of the underlying integer.

fn bits_mut(&mut self) -> &mut Self::Bits[src][]

Returns a mutable reference to the underlying integer.

Provided methods

unsafe fn read_bit(&self, offset: Self::Bits) -> bool[src][]

Returns true if the bit at offset is set.

Safety

offset must not exceed the integer size.

unsafe fn set_bit(&mut self, offset: Self::Bits)[src][]

Sets the bit at offset.

Safety

offset must not exceed the integer size.

unsafe fn clear_bit(&mut self, offset: Self::Bits)[src][]

Clears the bit at offset.

Safety

offset must not exceed the integer size.

unsafe fn toggle_bit(&mut self, offset: Self::Bits)[src][]

Toggles the bit at offset.

Safety

offset must not exceed the integer size.

unsafe fn read_bits(&self, offset: Self::Bits, width: Self::Bits) -> Self::Bits[src][]

Returns width number of bits at offset position.

Safety

offset + width must not exceed the integer size.

unsafe fn write_bits(
    &mut self,
    offset: Self::Bits,
    width: Self::Bits,
    bits: Self::Bits
)
[src][]

Writes width number of bits at offset position from bits.

Safety

offset + width must not exceed the integer size.

Implementors

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val

impl Bitfield for Val