diondokter / device-driver

A toolkit to create better Rust device drivers, faster
https://diondokter.github.io/device-driver/
Apache License 2.0
96 stars 4 forks source link

Feature request: Strict mode #12

Closed korken89 closed 3 months ago

korken89 commented 3 years ago

A way to say to the macro that I do not want a fallible interface for register decoding (enums). So if it can detect that an fallible interface would be generated it should scream at me, or maybe a trait error. :)

The infallible interface would also be nice if it could be related to the bit size, e.g. a 2 bit field that is linked to a 4 variant enum (or less + FromPrimitive implemented). Then it is known that the entire value span is well defined.

korken89 commented 3 years ago

I was playing around a little, and the following crate gave a lot of good underlying support for enums (and a lot more): https://docs.rs/modular-bitfield

diondokter commented 3 months ago

This is now sorta kinda implemented by #24, so I'm gonna close this issue :) (There's no detection because that's kinda hard the way everything is setup, but you can say it's strict and get a type error when it isn't)