Iterate through lines and choices

This commit is contained in:
Ryan Geary 2019-09-10 17:59:42 -04:00
parent 055f38a9ba
commit 42b1af66a6

View file

@ -47,13 +47,16 @@ fn main() {
let buf = BufReader::new(read);
for line in buf.lines() {
println!("{}", line.unwrap());
let lines: Vec<String> = buf.lines().map(|x| x.unwrap()).collect();
for line in lines {
for choice in &opt.choice {
choice.print_choice(&line);
}
println!();
}
println!("Hello, world!");
}
fn parse_choice(src: &str) -> Result<Choice, ParseIntError> {
let re = Regex::new(r"^(\d*):(\d*)$").unwrap();