Closed jam1garner closed 3 years ago
Clippy absolutely calling me out. Ident derefs to str
? Ugh I wish I knew that months ago.
Edit: nevermind totally misread the lint.
As a test case you could take my example from the issue:
use modular_bitfield::prelude::*;
#[derive(BitfieldSpecifier)]
#[bits = 3]
pub enum Weekday { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }
#[bitfield(specifier = true)]
pub struct Date {
#[bits = 3]
weekday: Weekday,
week: u8,
}
#[bitfield]
pub struct FromTo {
#[bits = 11]
from: Date,
#[bits = 11]
to: Date,
distance: B10,
}
The only thing you need in order to make it a real test is to add a fn main() { .. }
that asserts the expected debug output.
For inspiration on how to do the checks and extractions for attributes on the #[bitfield]
struct and re-expansions take a look at:
https://github.com/Robbepop/modular-bitfield/blob/robin-implement-repr/impl/src/bitfield.rs#L121
I am closing this now since I pulled your commits over to some local branch in order to integrate your derive implementation to the new config architecture. Thanks for the PR and work! Your commits are going to be included in the commit log to honor your work! :)
I have created the follow-up PR here: https://github.com/Robbepop/modular-bitfield/pull/39 @jam1garner
Implementation for my suggestion from #31.