mirror of
https://github.com/theryangeary/choose
synced 2024-11-26 21:00:17 +00:00
Iterate through lines and choices
This commit is contained in:
parent
055f38a9ba
commit
42b1af66a6
1 changed files with 7 additions and 4 deletions
11
src/main.rs
11
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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue