Replies: 1 comment
-
|
I'm on mobile or else I would write it out, but have you looked at this? https://docs.rs/csv/latest/csv/struct.ByteRecord.html#method.deserialize I think that should be able to do what you want. Otherwise you might need to abdicate serde. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to use the convenience of
csv::Reader::deserializeautomatically mapping columns to struct fields while also preserving unknown columns found in CSV as is.Currently I use a hack like this:
, but preserving other columns is tricky - I need to write csv manually, without serializing. Also using
Stringinstead ofserde_json::Valuemakes it reject numbers in those unknown columns.Is there some better way to handle this (without manually interpreting csv header)?
Maybe there is other deserialisation function that also gives a
csv::ByteRecord/csv::StringRecordwith the rest of fields? Or I can somehow#[serde(flatten)]the record type directly instead of resorting to a map?Beta Was this translation helpful? Give feedback.
All reactions