Skip to content

Commit

Permalink
docs(README): fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m committed Oct 14, 2015
1 parent 5fa313c commit 0375db3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ fn main() {
pb.inc();
thread::sleep_ms(200);
}
println("done!");
println!("done!");
}
```

2. Broadcast writing(simple file copying)

```rust
#![feature(io)]
extern crate pbr;

use std::io::copy;
use std::io::prelude::*;
use std::fs::{self, File};
use pbr::{ProgressBar, Units};

Expand All @@ -37,7 +39,7 @@ fn main() {
let mut file = File::open(fname).unwrap();
let n_bytes = fs::metadata(fname).unwrap().len() as usize;
let mut pb = ProgressBar::new(n_bytes);
pb.set_units(pb::Units::Bytes);
pb.set_units(Units::Bytes);
let mut dfile = File::create("copy-words").unwrap();
let mut handle = dfile.broadcast(&mut pb);
copy(&mut file, &mut handle).unwrap();
Expand Down

0 comments on commit 0375db3

Please sign in to comment.