bitfield-struct-rs
bitfield-struct-rs copied to clipboard
Procedural macro for bitfields.
Using `[u8; N]` as the backing store instead of integers has the following benefits. 1. Support more unconventional bitfield sizes (like 24bit) without unnecessary padding 2. Support for larger bitfields...
First off: thanks for this crate! The syntax is clean and intuitive, and is a lot easier to use than the other bitfield crates i've seen on crates.io. Right now,...
The following sample ```rust use std::marker::PhantomData; #[bitfield(u32)] pub struct Foo { _unused: u32, _marker: PhantomData, } ``` Fails to compile with the following error: ```rust error: unsupported type --> main.rs:9:14...
I have a simple protocol that defines 2 bits for its Version field. Represented as an enum, only the values of 0 and 1 are valid - values 2 and...
```rs #[bitfield(u64)] #[derive(PartialEq)] pub struct Message { #[bits(8)] pub message_id: u8, #[bits(24)] pub time_of_reception: u32, #[bits(3456)] pub payload: [u8; 432], } ``` if i remove `(u64)`, throws `unknown type`. How...
Assuming i have stuct with padding. ```rust #[bitfield(u8)] #[derive(Hash)] struct MyBitfield { #[bits(4)] cnt: u8, #[bits(2)] type: u8, /// Padding #[bits(2)] __: u8, } ``` It is currently not documented...
Hey, thanks for the great crate! It would be neat if there was a failable version, for cases when an enumeration with an integral `repr` doesn't use the full range...