Trait nbits_vec::value::Value
[−]
[src]
pub trait Value {
type Block: PrimInt + One + Zero + LowerHex + Hash;
fn nbits() -> usize;
fn one() -> Self::Block { ... }
fn zero() -> Self::Block { ... }
fn mask() -> Self::Block { ... }
fn block_bits() -> usize { ... }
fn is_aligned() -> bool { ... }
fn is_packed() -> bool { ... }
}
Associated Types
type Block: PrimInt + One + Zero + LowerHex + Hash
The storage type of Values.
The Block should be one of the primitive integer ie. u8, u16 u32, u64.
Recommend that not to use usize because it is platform dependent.
Required Methods
Provided Methods
fn one() -> Self::Block
Return 1
fn zero() -> Self::Block
Return 0
fn mask() -> Self::Block
The value's bit mask in the Block.
For example, 2-bit value mask is 0b11, 3-bit mask is 0b111.
fn block_bits() -> usize
Bit-size of Block.
fn is_aligned() -> bool
Value is aligned when block_bits is divisible by nbits.
fn is_packed() -> bool
Value is packed when block_bits is equal to nbits.
Implementors
impl Value for N1B8impl Value for N1B16impl Value for N1B32impl Value for N1B64impl Value for N2B8impl Value for N2B16impl Value for N2B32impl Value for N2B64impl Value for N3B8impl Value for N3B16impl Value for N3B32impl Value for N3B64impl Value for N4B8impl Value for N4B16impl Value for N4B32impl Value for N4B64impl Value for N5B8impl Value for N5B16impl Value for N5B32impl Value for N5B64impl Value for N6B8impl Value for N6B16impl Value for N6B32impl Value for N6B64impl Value for N7B8impl Value for N7B16impl Value for N7B32impl Value for N7B64impl Value for N9B16impl Value for N9B32impl Value for N9B64impl Value for N10B16impl Value for N10B32impl Value for N10B64impl Value for N11B16impl Value for N11B32impl Value for N11B64impl Value for N12B16impl Value for N12B32impl Value for N12B64impl Value for N13B16impl Value for N13B32impl Value for N13B64impl Value for N14B16impl Value for N14B32impl Value for N14B64impl Value for N15B16impl Value for N15B32impl Value for N15B64impl Value for N17B32impl Value for N17B64impl Value for N18B32impl Value for N18B64impl Value for N19B32impl Value for N19B64impl Value for N20B32impl Value for N20B64impl Value for N21B32impl Value for N21B64impl Value for N22B32impl Value for N22B64impl Value for N23B32impl Value for N23B64impl Value for N24B32impl Value for N24B64impl Value for N25B32impl Value for N25B64impl Value for N26B32impl Value for N26B64impl Value for N27B32impl Value for N27B64impl Value for N28B32impl Value for N28B64impl Value for N29B32impl Value for N29B64impl Value for N30B32impl Value for N30B64impl Value for N31B32impl Value for N31B64impl Value for N33B64impl Value for N34B64impl Value for N35B64impl Value for N36B64impl Value for N37B64impl Value for N38B64impl Value for N39B64impl Value for N40B64impl Value for N41B64impl Value for N42B64impl Value for N43B64impl Value for N44B64impl Value for N45B64impl Value for N46B64impl Value for N47B64impl Value for N48B64impl Value for N49B64impl Value for N50B64impl Value for N51B64impl Value for N52B64impl Value for N53B64impl Value for N54B64impl Value for N55B64impl Value for N56B64impl Value for N57B64impl Value for N58B64impl Value for N59B64impl Value for N60B64impl Value for N61B64impl Value for N62B64impl Value for N63B64