diff options
author | Ryan Geary <rtgnj42@gmail.com> | 2019-09-10 17:59:42 -0400 |
---|---|---|
committer | Ryan Geary <rtgnj42@gmail.com> | 2019-09-10 17:59:42 -0400 |
commit | 42b1af66a63682222849364109b93f7d2e8c0ee1 (patch) | |
tree | 2f2ce5109939b4f067c3775cc1272aea6b8659fa | |
parent | 055f38a9baff01bb4521ace639b520b75417faa5 (diff) |
Iterate through lines and choices
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 48f4f9e..b236775 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(); |