rust-bitfield
rust-bitfield copied to clipboard
This crate provides macros to generate bitfield-like struct.
I recently used `bitfield `in a project where I found the API passing MSB and LSB a bit cumbersome: https://github.com/gfroerli/firmware/pull/82/files#diff-8ba2aa3932cb35175d51de283952144c82bcf45eef54f18f72f199650929ee80R24 It would have been more intuitive for me to pass...
It would be nice to be able to hide the inner element of the "newtypes".
So that we can use enums even if the field is only 1 bit wide. It can currently be worked around by using `into Type, field1, _: 2, 2;` But...
As discussed in https://github.com/dzamlo/rust-bitfield/pull/21#issuecomment-496318709 This would replaced the `from into`
It looks like the `bitfield` macro supports placing pretty much any compiler attribute on the struct or on any field. This is very useful, especially for doing things like `#[derive(Clone)]`....
The `bitfield` method only creates getter and accessor methods. It would be great if it could create constructors too. For example, ```rust bitfield! { struct Foo(u16); u8; a, _: 7,...
Could you please add an overview of the design to the documentation? I can't get an idea for how efficiently this crate is implemented without reading the source, and macro...
With this option, you will still get the `BitRange` implementation, the `Debug` implementation and the fields getter and setter.
We should add a way to call arbitrary method on the value before returning it. For example to do endianness conversion. I don't know yet how it would look like.