Repository navigation
add enum type parameter to Field to prevent read_as_enum() mismatch - #102
nataliepopescu wants to merge 1 commit into
Conversation
|
Without thinking too deeply about this yet, I believe the reason that we didn't do this previously is because the actual On the core team call earlier today, we discussed this briefly, and I think the fuzzy consensus is that these enum types should somehow be more prominent and used more comprehensively (e.g., all registers, even those without fields (single-variant then), create enums and read returns an enum); but my instinct is to hold off on changing this API in isolation until we've had a chance to think through the enum story more comprehensively. |
|
I worked on a version of what we discussed, and, I'm not too excited about it. The macro can create a register.read(Status::ERRORCOUNT).value()The problem is, without something like this PR, Rust in this case can't tell what the enum type is, because it isn't used as the return value. So it actually has to look like: register.read::<Status::ERRORCOUNT::Value>(Status::ERRORCOUNT).value()which is clumsy. |
Pull Request Overview
This pull request fixes the field Value / RegisterLongName mismatch issue described in #100 by adding type parameter
EtoField.TODO or Help Wanted
This pull request still needs...
Checklist
make testormake full.PR Contents
Documentation
/doc.AI Use