bitmaps

Trait BitOps

Source
pub trait BitOps {
    // Required methods
    fn get(bits: &Self, index: usize) -> bool;
    fn set(bits: &mut Self, index: usize, value: bool) -> bool;
    fn len(bits: &Self) -> usize;
    fn first_index(bits: &Self) -> Option<usize>;
    fn bit_and(bits: &mut Self, other_bits: &Self);
    fn bit_or(bits: &mut Self, other_bits: &Self);
    fn bit_xor(bits: &mut Self, other_bits: &Self);
    fn invert(bits: &mut Self);
    fn make_mask(shift: usize) -> Self;
    fn to_hex(bits: &Self) -> String;
}
Expand description

A trait that defines generalised operations on a Bits::Store type.

Required Methods§

Source

fn get(bits: &Self, index: usize) -> bool

Source

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source

fn len(bits: &Self) -> usize

Source

fn first_index(bits: &Self) -> Option<usize>

Source

fn bit_and(bits: &mut Self, other_bits: &Self)

Source

fn bit_or(bits: &mut Self, other_bits: &Self)

Source

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source

fn invert(bits: &mut Self)

Source

fn make_mask(shift: usize) -> Self

Source

fn to_hex(bits: &Self) -> String

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 BitOps for bool

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for u8

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for u16

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for u32

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for u64

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for u128

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn make_mask(shift: usize) -> Self

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 2]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 3]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 4]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 5]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 6]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 7]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Source§

impl BitOps for [u128; 8]

Source§

fn get(bits: &Self, index: usize) -> bool

Source§

fn set(bits: &mut Self, index: usize, value: bool) -> bool

Source§

fn make_mask(shift: usize) -> Self

Source§

fn len(bits: &Self) -> usize

Source§

fn first_index(bits: &Self) -> Option<usize>

Source§

fn bit_and(bits: &mut Self, other_bits: &Self)

Source§

fn bit_or(bits: &mut Self, other_bits: &Self)

Source§

fn bit_xor(bits: &mut Self, other_bits: &Self)

Source§

fn invert(bits: &mut Self)

Source§

fn to_hex(bits: &Self) -> String

Implementors§