#bit-fields #byte #range #generate #byte-array #macro

no-std u8bits

This crate provides a macro to generate accessors for parts of newtype byte arrays

1 unstable release

0.1.0 Jan 6, 2019

#76 in #bitfields

MIT license

9KB
84 lines

u8bits

rust macro to generate setters and getters for bits / bit ranges of u8 arrays

Build Status

This macro invocation:

struct Bytes( [u8;2]);
impl Bytes {
	u8bits! {
		/// foo is bit 4 of byte 0
		foo: rw 0,4;
		/// bar are bits 0..3 of byte 1
		u8, bar: rw 1,0,3;
	}
}

will generate get_ and set_ for foo and bar.


lib.rs:

A macro to generate bit field like getters and setters on structs which represent an array of bytes.

See the documentation of the macro for how to use it.

Dependencies

~11KB