I found that cargo run --example csv_vectors produced incorrect output:
Query { r: [], s: 12 }
Where, based on the example, I expected:
Query { r: [1, 2, 3], s: 12 }
I believe the csv::Reader::from_reader function expects data where each line is a record. However, in the example, all values are on a single line, so the CSV reader treats them as columns of a single record.
I adjusted the from_csv function's trait bounds to ensure that T can be both deserialized and converted from a string. I also revamped the CSV parsing using ReaderBuilder for a bit more flexibility.
This new implementation produces the expected output.
I found that
cargo run --example csv_vectors
produced incorrect output:Where, based on the example, I expected:
I believe the
csv::Reader::from_reader
function expects data where each line is a record. However, in the example, all values are on a single line, so the CSV reader treats them as columns of a single record.I adjusted the from_csv function's trait bounds to ensure that T can be both deserialized and converted from a string. I also revamped the CSV parsing using ReaderBuilder for a bit more flexibility.
This new implementation produces the expected output.