[][src]Trait atomic_bitfield::AtomicBitField

pub trait AtomicBitField: Sized {
    fn get_bit(&self, bit: usize, ord: Ordering) -> bool;
fn set_bit(&self, bit: usize, ord: Ordering) -> bool;
fn clear_bit(&self, bit: usize, ord: Ordering) -> bool;
fn toggle_bit(&self, bit: usize, ord: Ordering) -> bool; fn bit_len() -> usize { ... }
fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool { ... } }

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.

Loading content...

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.

Loading content...

Implementations on Foreign Types

impl AtomicBitField for AtomicU8[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicU16[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicU32[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicUsize[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicI8[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicI16[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicI32[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

impl AtomicBitField for AtomicIsize[src]

fn bit_len() -> usize[src]

fn swap_bit(&self, bit: usize, new_val: bool, ord: Ordering) -> bool[src]

Loading content...

Implementors

Loading content...