Trait BitArray

Source
pub trait BitArray:
    Sized
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitXor<Output = Self>
    + Not<Output = Self>
    + Copy {
    const LEN: usize;

    // Required methods
    fn splat(s: bool) -> Self;
    fn get_bit(self, index: usize) -> bool;
    fn set_bit(&mut self, index: usize, sign: bool);
    fn count_ones(self) -> u32;
    fn transpose_in_place(a: &mut BitMatrix<Self, { Self::LEN }>);
}
Expand description

Things we can do to an array of bits.

Required Associated Constants§

Source

const LEN: usize

Number of bits on the array.

Required Methods§

Source

fn splat(s: bool) -> Self

Splats the sign across the bit array.

Source

fn get_bit(self, index: usize) -> bool

Get a bit. Poor performance, used only for testing and debugging.

Source

fn set_bit(&mut self, index: usize, sign: bool)

Set a bit. Poor performance, used only for testing and debugging.

Source

fn count_ones(self) -> u32

Source

fn transpose_in_place(a: &mut BitMatrix<Self, { Self::LEN }>)

Transpose a square matrix in place. This will likely be better performance than using Transpose::transpose().

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.

Implementors§

Source§

impl BitArray for B8

Source§

const LEN: usize = 8usize

Source§

impl BitArray for B16

Source§

const LEN: usize = 16usize

Source§

impl BitArray for B32

Source§

const LEN: usize = 32usize

Source§

impl BitArray for B64

Source§

const LEN: usize = 64usize

Source§

impl BitArray for B128

Source§

const LEN: usize = 128usize

Source§

impl BitArray for B256

Source§

const LEN: usize = 256usize

Source§

impl BitArray for B512

Source§

const LEN: usize = 512usize