Created
May 17, 2014 06:51
-
-
Save lilyball/00611608e49d1eba06a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn process_files(files: Vec<File>, progress: Sender<uint>) { | |
let mut it = files.iter().filter(|&f| test_file(f)).enumerate(); | |
loop { | |
let (i, f) = match it.next() { | |
None => break, | |
Some(x) => x | |
}; | |
if i % 100 == 0 { | |
let (lower, upper) = it.size_hint(); | |
progress.send(upper.unwrap_or(lower)); | |
} | |
process_file(f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment