modular-bitfield icon indicating copy to clipboard operation
modular-bitfield copied to clipboard

Implement `AsRef` and `AsMut` instances for `repr(uN)` bitfields

Open ollie-etl opened this issue 3 years ago • 2 comments

For repr(uN) bitfields, it'd be helpful to be able to view a reference to the bitfield as a reference to the representation type without copy.

The opposite is also true - there are occasions when I'd like to operate on a primitive type as though it were a bitfield.

ollie-etl avatar Apr 14 '21 12:04 ollie-etl

I'm happy to submit a RP if this is considered desirable ^

ollie-etl avatar Apr 14 '21 12:04 ollie-etl

I can't think of an implementation not requiring unsafe. Stdlib functions i.e. from_ne_byes copy.

ollie-etl avatar Apr 15 '21 07:04 ollie-etl