Trying to access the variable sentences for a second time causes value used here after move, I want to understand how to store the total without causing this problem.
I tried to copy the iterator but I can't find a way to make it work or how is the correct way to do it.
extern crate regex;
use std::fs::File;
use std::path::Path;
use std::io::{BufReader, BufRead};
fn main() {
let sentences_path = Path::new("csv/testSentences.csv");
let sentences = BufReader::new(File::open(&sentences_path).unwrap());
let total = sentences.lines().count();
for (index, sentence) in sentences.lines().enumerate() {
let line = sentence.unwrap();
println!("Processed {} of {}, {}", index, total, line);
}
println!("Total {}", total);
}