Jefftime

Rust BS

Oct 16th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.49 KB | None | 0 0
  1. let tmpfile = BufReader::new(manifest.get_ref().clone());
  2. let lines: Vec<Result<String, std::io::Error>> = tmpfile.lines().collect();
  3. let mut count = 0;
  4. for line in lines {
  5.     match line {
  6.         Ok(ref s) => {
  7.             println!("line: {}", s);
  8.             if !s.is_empty() {
  9.                 println!("This line is not empty");
  10.                 count += 1;
  11.             }
  12.         },
  13.         _ => println!("line: (null)")
  14.     };
  15. }
  16. println!("Number of non-blank lines: {}", count);
Advertisement
Add Comment
Please, Sign In to add comment