Skip to content

Commit

Permalink
Update README for changes and tweak examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed Mar 4, 2015
1 parent 9014b61 commit 77fdafe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ strings):
```rust
extern crate csv;

use std::path::Path;

fn main() {
let fp = &Path::new("./data/simple.csv");
let mut rdr = csv::Reader::from_file(fp);

let mut rdr = csv::Reader::from_file("./data/simple.csv").unwrap();
for record in rdr.decode() {
let (s1, s2, dist): (String, String, usize) = record.unwrap();
println!("({}, {}): {}", s1, s2, dist);
Expand All @@ -47,8 +43,6 @@ Don't like tuples? That's fine. Use a struct instead:
extern crate csv;
extern crate "rustc-serialize" as rustc_serialize;

use std::path::Path;

#[derive(RustcDecodable)]
struct Record {
s1: String,
Expand All @@ -57,9 +51,7 @@ struct Record {
}

fn main() {
let fp = &Path::new("./data/simple.csv");
let mut rdr = csv::Reader::from_file(fp);

let mut rdr = csv::Reader::from_file("./data/simple.csv").unwrap();
for record in rdr.decode() {
let record: Record = record.unwrap();
println!("({}, {}): {}", record.s1, record.s2, record.dist);
Expand Down
1 change: 0 additions & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ extern crate csv;

fn main() {
let mut rdr = csv::Reader::from_file("./data/simple.csv").unwrap();

for record in rdr.decode() {
let (s1, s2, dist): (String, String, usize) = record.unwrap();
println!("({}, {}): {}", s1, s2, dist);
Expand Down
4 changes: 1 addition & 3 deletions examples/simple_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ struct Record {
}

fn main() {
let fp = "./data/simple.csv";
let mut rdr = csv::Reader::from_file(fp).unwrap();

let mut rdr = csv::Reader::from_file("./data/simple.csv").unwrap();
for record in rdr.decode() {
let record: Record = record.unwrap();
println!("({}, {}): {}", record.s1, record.s2, record.dist);
Expand Down

0 comments on commit 77fdafe

Please sign in to comment.