[][src]Crate u8bits

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.

Re-exports

pub use paste;

Macros

u8bits

This macro allows the generaion of bit field like getters and setters for a New Type struct of type [u8;N]. There are bit wise accessors and bit range accessors. The bitwise operations map to an boolean value whereas the bit range operations use an provided type which has to implement the .into() conversion trait. The bit wise field declaration is as follows:

Functions

get_bit

Get the bit at position 'pos' of byte 'b'.

get_bit_range

Return the 'value' of byte 'b' in the range of the given bit positions 'lsb' (least significant bit) and 'msb' (most significant bit) inclusive.

set_bit

Set the bit at position 'pos' of byte 'b'.

set_bit_range

Set the given 'value' in byte 'b' in the range of the given bit positions 'lsb' (least significant bit) and 'msb' (most significant bit) inclusive. the other bits are not touched.