mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-22 03:23:05 +00:00
Use provided struct in CSV tab delimiter example (#499)
The CSV encoding tab delimiter example has a struct to deserialize into. However it wasn't used. I've changed it to use the provided struct. It may make more sense to remove it instead, as it isn't the point of this example. If it turns out to be the preferred method in the pull request process, I'll do so.
This commit is contained in:
parent
3491f21654
commit
7119dc5ad9
1 changed files with 1 additions and 1 deletions
|
@ -33,7 +33,7 @@ Mark\tMelbourne\t46
|
|||
Ashley\tZurich\t92";
|
||||
|
||||
let mut reader = ReaderBuilder::new().delimiter(b'\t').from_reader(data.as_bytes());
|
||||
for result in reader.records() {
|
||||
for result in reader.deserialize::<Record>() {
|
||||
println!("{:?}", result?);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue