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
-
I want to use the convenience of
csv::Reader::deserialize
automatically 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
String
instead ofserde_json::Value
makes 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::StringRecord
with 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