rust-csv
rust-csv copied to clipboard
Handle CSV files with "duplicate field" by reading the values in a vector
I've just encountered the same problem as was described in #353. I was wondering about a different solution:
Given a header with duplicate fields:
name,other,name'
I wonder if the values could be deserialized into a vector. Assuming this is the definition of the struct:
#[derive(Deserialize, Debug)]
struct Message {
name: Vec<String>,
other: String,
}
I think my answer remains the same. And I'm not even sure this is possible to do in the deserializer. And it should really be supported in serialization. And on top of that, this strikes me as ambiguous with the feature of capturing the "tail" of the record: https://docs.rs/csv/latest/csv/struct.Reader.html#rules