pub trait BitOps {
Show 18 methods
// 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 first_false_index(bits: &Self) -> Option<usize>;
fn last_index(bits: &Self) -> Option<usize>;
fn last_false_index(bits: &Self) -> Option<usize>;
fn next_index(bits: &Self, index: usize) -> Option<usize>;
fn next_false_index(bits: &Self, index: usize) -> Option<usize>;
fn prev_index(bits: &Self, index: usize) -> Option<usize>;
fn prev_false_index(bits: &Self, index: usize) -> 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 bit_size() -> usize;
fn to_hex(bits: &Self) -> String;
}
Expand description
A trait that defines generalised operations on a Bits::Store
type.
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 first_false_index(bits: &Self) -> Option<usize>
fn last_index(bits: &Self) -> Option<usize>
fn last_false_index(bits: &Self) -> Option<usize>
fn next_index(bits: &Self, index: usize) -> Option<usize>
fn next_false_index(bits: &Self, index: usize) -> Option<usize>
fn prev_index(bits: &Self, index: usize) -> Option<usize>
fn prev_false_index(bits: &Self, index: usize) -> 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 bit_size() -> usize
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.