Open amirbou opened 3 months ago
Hi, thanks for your report! Implementing BinWrite
for PosValue<T>
seems reasonable to me since this is just a wrapper type for position metadata. I feel less certain about adding From<T>
and Default
implementations but can’t think of anything off the top of my head that would be hurt by it. Go ahead and open a PR any time!
Hey, currently
PosValue
does not implementBinWrite
, which prevents it from being used in structs using#[binrw]
.On my machine I implemented (for
PosValue<T>
):BinWrite
- by ignoring thepos
fieldFrom<T>
- by settingpos=0
, making construction easierDefault
ifT: Default
- by settingpos=0
, allowing#[derive(Default)]
on structs usingPosValue
I added some asserts in
pos_value.rs
to check everything, and it seems to be working correctly.May I go ahead and open a PR with the changes?
Thanks!