[−][src]Trait atomic_bitfield::AtomicBitField
Generic trait for manipulating bits atomically.
Required methods
fn get_bit(&self, bit: usize, ord: Ordering) -> bool
Atomically retrieves the bit at index bit
(zero-indexed).
Panics
This method will panic if the bit index is out of bounds of the bit field.
fn set_bit(&self, bit: usize, ord: Ordering) -> bool
Atomically sets the bit to true
at index bit
(zero-indexed), returning the previous value.
Panics
This method will panic if the bit index is out of bounds of the bit field.
fn clear_bit(&self, bit: usize, ord: Ordering) -> bool
Atomically clears the bit (sets to false
) at index bit
(zero-indexed), returning the previous value.
Panics
This method will panic if the bit index is out of bounds of the bit field.
fn toggle_bit(&self, bit: usize, ord: Ordering) -> bool
Atomically toggles the bit (0 -> 1
, 1 -> 0
) at index bit
(zero-indexed), returning the previous value.
Panics
This method will panic if the bit index is out of bounds of the bit field.
Provided methods
fn bit_len() -> usize
Returns the number of bits in this atomic type.
fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool
Atomically sets the bit to new_val
at index bit
(zero-indexed), returning the previous value.
Panics
This method will panic if the bit index is out of bounds of the bit field.