Expand description
§bits
Width-aware bit manipulation around a single Bits<T> newtype.
use bitkit::prelude::*;
let x = Bits::<u32>::new(0b1011_0000);
assert_eq!(x.isolate_lowest_set_bit(), Bits::new(0b0001_0000));
assert_eq!(x.set_bit(0)?, Bits::new(0b1011_0001));
assert_eq!(x.extract(1..4)?, Bits::new(0b000));§Modules
Modules§
- align
- Power-of-two alignment over
usize.alignmust be a non-zero power of two. - bytes
- Read/write integers from
&[u8]with explicit endianness. Never panics on short input. - explain
- Educational metadata for common bit hacks. Feature
explain. - format
- Allocation-free grouped-binary
Displaywrapper. - morton
- Morton (Z-order) curve encode / decode.
- prelude
use bitkit::prelude::*;to import the common types.
Structs§
- Bits
- Width-typed wrapper around a primitive unsigned integer.
- Flags
- Flag set wrapping a primitive unsigned integer.
Enums§
- BitError
- Every fallible operation returns
Result<_, BitError>.
Traits§
- Into
BitRange - Accept either
Range<u32>or(u32, u32)for bit-range arguments.