Closed ctron closed 4 years ago
Testing quickly locally, it's seems to works. Could you share the definitions of drogue_bme680::Coefficients
and the call to bitfield!
?
No Debug
implementation is generated by default. You need to add impl Debug
(like https://github.com/dzamlo/rust-bitfield/blob/d7d9d3b2cfac226ab5d29d9d6a641caff7dbdf8b/tests/lib.rs#L598 for exemple)
Yes, that is true. But did you try to actually print it?
Here is a simple reproducer:
use bitfield::bitfield;
bitfield! {
pub struct Test([u8]);
impl Debug;
}
fn main() {
let buffer = [0u8;41];
let test = Test(buffer);
println!("{:?}", test);
}
This works on the nightly and beta toolchains, but not on stable. The current beta will become stable next week if I can count weeks correctly.
I will not implement support for not including .0
in the Debug
implementation but I will gladly accept a merge request if you think this is really useful.
If this works next week, that would be fine for me. I would prefer solving a problem by waiting a few days :grin:
What would it take to support defmt::Format
so this can be used in an embedded context?
https://docs.rs/defmt/latest/defmt/trait.Format.html
Or maybe I'm using it wrong?
Having a structure which is backed by an array of bytes that is greater than 32 bytes fails:
I think there should be a way to prevent the automatic
Debug
generation to debugself.0
, which should do the trick.