Trait BitBlock

Source
pub trait BitBlock:
    BitAnd<Output = Self>
    + BitAndAssign
    + BitOr<Output = Self>
    + BitOrAssign
    + BitXor<Output = Self>
    + BitXorAssign
    + Eq
    + PartialEq
    + MaybeSerialize
    + for<'de> MaybeDeserialize<'de>
    + Debug
    + Sized
    + Copy
    + Clone {
    type BitsIter: BitQueue;
    type BytesArray: PrimitiveArray<Item = u8>;

    const SIZE_POT_EXPONENT: usize;
Show 16 methods // Required methods fn zero() -> Self; fn into_bits_iter(self) -> Self::BitsIter; fn as_array(&self) -> &[u64]; fn as_array_mut(&mut self) -> &mut [u64]; fn to_ne_bytes(self) -> Self::BytesArray; fn to_le_bytes(self) -> Self::BytesArray; fn from_ne_bytes(bytes: Self::BytesArray) -> Self; fn from_le_bytes(bytes: Self::BytesArray) -> Self; // Provided methods fn size() -> usize { ... } fn is_zero(&self) -> bool { ... } unsafe fn set_bit_unchecked<const BIT: bool>( &mut self, bit_index: usize, ) -> bool { ... } unsafe fn get_bit_unchecked(&self, bit_index: usize) -> bool { ... } fn traverse_bits<F, B>(&self, f: F) -> ControlFlow<B> where F: FnMut(usize) -> ControlFlow<B> { ... } fn for_each_bit<F>(&self, f: F) where F: FnMut(usize) { ... } fn to_le(self) -> Self { ... } fn count_ones(&self) -> usize { ... }
}
Expand description

Bit block.

Used in Config, to define bit blocks BitSet is built from.

Required Associated Constants§

Required Associated Types§

Source

type BitsIter: BitQueue

Source

type BytesArray: PrimitiveArray<Item = u8>

Required Methods§

Source

fn zero() -> Self

Source

fn into_bits_iter(self) -> Self::BitsIter

Source

fn as_array(&self) -> &[u64]

Source

fn as_array_mut(&mut self) -> &mut [u64]

Source

fn to_ne_bytes(self) -> Self::BytesArray

Source

fn to_le_bytes(self) -> Self::BytesArray

Source

fn from_ne_bytes(bytes: Self::BytesArray) -> Self

Source

fn from_le_bytes(bytes: Self::BytesArray) -> Self

Provided Methods§

Source

fn size() -> usize

Size in bits

Source

fn is_zero(&self) -> bool

Source

unsafe fn set_bit_unchecked<const BIT: bool>( &mut self, bit_index: usize, ) -> bool

Returns previous bit

§Safety

bit_index must be < SIZE

Source

unsafe fn get_bit_unchecked(&self, bit_index: usize) -> bool

§Safety

bit_index must be < SIZE

Source

fn traverse_bits<F, B>(&self, f: F) -> ControlFlow<B>
where F: FnMut(usize) -> ControlFlow<B>,

Returns Break if traverse was interrupted (f returns Break).

Source

fn for_each_bit<F>(&self, f: F)
where F: FnMut(usize),

Source

fn to_le(self) -> Self

Source

fn count_ones(&self) -> usize

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BitBlock for u64

Source§

const SIZE_POT_EXPONENT: usize = 6usize

Source§

type BitsIter = PrimitiveBitQueue<u64>

Source§

type BytesArray = [u8; 8]

Source§

fn zero() -> Self

Source§

unsafe fn set_bit_unchecked<const BIT: bool>( &mut self, bit_index: usize, ) -> bool

Source§

unsafe fn get_bit_unchecked(&self, bit_index: usize) -> bool

Source§

fn traverse_bits<F, B>(&self, f: F) -> ControlFlow<B>
where F: FnMut(usize) -> ControlFlow<B>,

Source§

fn into_bits_iter(self) -> Self::BitsIter

Source§

fn as_array(&self) -> &[u64]

Source§

fn as_array_mut(&mut self) -> &mut [u64]

Source§

fn to_ne_bytes(self) -> Self::BytesArray

Source§

fn to_le_bytes(self) -> Self::BytesArray

Source§

fn from_ne_bytes(bytes: Self::BytesArray) -> Self

Source§

fn from_le_bytes(bytes: Self::BytesArray) -> Self

Source§

impl BitBlock for u64x2

Available on crate feature simd only.
Source§

const SIZE_POT_EXPONENT: usize = 7usize

Source§

type BitsIter = ArrayBitQueue<u64, 2>

Source§

type BytesArray = [u8; 16]

Source§

fn zero() -> Self

Source§

fn is_zero(&self) -> bool

Source§

fn into_bits_iter(self) -> Self::BitsIter

Source§

fn as_array(&self) -> &[u64]

Source§

fn as_array_mut(&mut self) -> &mut [u64]

Source§

fn to_ne_bytes(self) -> Self::BytesArray

Source§

fn to_le_bytes(self) -> Self::BytesArray

Source§

fn from_ne_bytes(bytes: Self::BytesArray) -> Self

Source§

fn from_le_bytes(bytes: Self::BytesArray) -> Self

Source§

impl BitBlock for u64x4

Available on crate feature simd only.
Source§

const SIZE_POT_EXPONENT: usize = 8usize

Source§

type BitsIter = ArrayBitQueue<u64, 4>

Source§

type BytesArray = [u8; 32]

Source§

fn zero() -> Self

Source§

fn into_bits_iter(self) -> Self::BitsIter

Source§

fn as_array(&self) -> &[u64]

Source§

fn as_array_mut(&mut self) -> &mut [u64]

Source§

fn to_ne_bytes(self) -> Self::BytesArray

Source§

fn to_le_bytes(self) -> Self::BytesArray

Source§

fn from_ne_bytes(bytes: Self::BytesArray) -> Self

Source§

fn from_le_bytes(bytes: Self::BytesArray) -> Self

Implementors§