Closed xgroleau closed 1 year ago
I've actually managed to extend Bilge using a derive macro. It shows how flexible the lib is. Now either we could want to add this by default or let the user extend bilge for the builder pattern.
Though maybe add to the documentation how ending the derive macro with *Bits
allows to get the original fields.
You're very right about the docs.
About "don't care" fields, we don't handle __reserved0
, but we do handle reserved
and then you don't have to pass these to the new
constructor (see the README for more info).
A derive for a type based builder pattern could be its own crate, you could even publish it yourself. On the other hand, I know bitbybit has some experimental builder shenanigans which I liked and it is annoying to set bitflags when you just do true, true, false, true
in a constructor.....
Oh I haven't realized reserved bits where supported! I'll close this issue since make your own derive macro actually fix the builder issue.
And yes if I have some time I'll write a crate for the builder pattern, the current code is far from ready for general usage.
We have multiple registers with "don't care" fields, it's a bit annoying to need to explicit every fields. Example:
It would be more explicit to have a builder pattern to know what are the boolean flags and it would also allow handling the "don't care" bits
And we could add default to those fields to avoid to always needing to explicitly set them.