The attribute documentation already mentions that the repr directive can be used on enums to specify what they should be represented as (https://docs.rs/binrw/latest/binrw/docs/attribute/index.html#repr).
What it does not mention, however, is that the directive can also be used on fields and on types that are not enums, where it will behave similarly: internally, binrw will read/write the type passed to the repr directive instead of the field's type and cast them into each other using From/Into (useful if you need to serialize a third party type that doesn't support binrw and imo nicer to use than parse_ and write_with).
I'm not sure if this use case is just a side effect of its enum use case or an intentional feature but regardless, since it's absolutely possible to use it this way, I think this should be mentioned in the documentation.
The attribute documentation already mentions that the
reprdirective can be used on enums to specify what they should be represented as (https://docs.rs/binrw/latest/binrw/docs/attribute/index.html#repr).What it does not mention, however, is that the directive can also be used on fields and on types that are not enums, where it will behave similarly: internally, binrw will read/write the type passed to the
reprdirective instead of the field's type and cast them into each other usingFrom/Into(useful if you need to serialize a third party type that doesn't support binrw and imo nicer to use thanparse_andwrite_with).I'm not sure if this use case is just a side effect of its enum use case or an intentional feature but regardless, since it's absolutely possible to use it this way, I think this should be mentioned in the documentation.