Ben Chuanlong Du's Blog

It is never too late to learn.

Useful Rust Crates for Bit Manipulations

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

bytemuck

ByteMuck is a crate for mucking around with piles of bytes. It lets you safely perform "bit cast" operations between data types. That's where you take a value and just reinterpret the bits as being some other type of value, without changing the bits. It is like f32::to_bits, just generalized to let you convert between all sorts of data types.

bitflags

bitflags is a Rust macro to generate structures which behave like a set of bitflags.

bitvec

bitvec addresses memory by bits, for packed collections and bitfields

byteorder

byteorder is a library for reading/writing numbers in big-endian and little-endian.

bytes

bytes is a utility library for working with bytes.

Comments