Closed dbrgn closed 5 years ago
Rebased and formatting fixed. I hope the tests pass now.
If this is merged, do you plan a new release? Would be great to have this functionality available soon.
I think a more elegant solution to your problem would be to just implement Copy
for for RawLatitude
/RawLongitude
/RawCoord
.
RawCoord
only has a u16, u8, and an instance of an enum with 4 variants + no data -> it should easily fit inside a 32 bit word/half word, making an implicit copy dirt cheap.
igc 0.2.2 is published on crates.io, which contains a Copy
impl for RawCoord
+ its newtypes.
Thanks! That's also a good solution :slightly_smiling_face:
Previously converting raw coordinates would always consume them.
For example, this does not currently work:
...because the first line consumes
pos
.Right now I have to resort to this awkward destructuring workaround:
...and afterwards I cannot use
b.pos
anymore because it has been consumed. OK in my case since I only use the floats anyways.I created a simple macro to avoid duplication. Let me know if you prefer a non-macro approach.