Skip to content

Instantly share code, notes, and snippets.

@erickt
Forked from lilyball/gist:00611608e49d1eba06a2
Last active August 29, 2015 14:01
Show Gist options
  • Save erickt/4cebaf11519569750892 to your computer and use it in GitHub Desktop.
Save erickt/4cebaf11519569750892 to your computer and use it in GitHub Desktop.
fn process_files(files: Vec<File>, progress: Sender<uint>) {
let mut count = 0;
let mut it = files.iter().inspect(|_| count += 1).filter(|&f| test_file(f)).enumerate();
loop {
let (i, f) = match it.next() {
None => break,
Some(x) => x
};
if i % 100 == 0 {
progress.send(files.len() - count);
}
process_file(f);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment