Referencing fields in #[brw]
is impossible due to value/ref differences between BinRead
and BinWrite
#179
Labels
confusing-api
Oops! Confusion occurred
It's tricky (impossible?) to use
assert
attribute inbrw
key. For example this code:Will give you an error
Can't compare &u8 with u8
, probably becauseunused
is a&u8
. But if you try to dereference it with*
you getType u8 cannot be dereferenced
. Really confusing.Ultimately this is due to
br
giving you fields by-value andbw
- by-reference. So, even when you want to enforce the invariant for both reading and writing, you would need to write two implementations in most cases.Maybe it's worth making them both provide fields by-reference? 🤔 Not sure what other impact it may have.
It seems there was a mention of
brw
usability forassert
being questionable in #3, but there doesn't seem to be much discussion...The text was updated successfully, but these errors were encountered: