diff --git a/src/main.rs b/src/main.rs index b01c0d2..68d4bfa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,9 +34,12 @@ fn main() { thread::sleep(time::Duration::from_millis(250)); let mut lights = lock.write().unwrap(); let pattern = format_multiline("val 255 150 0"); - let res = parse_line(pattern); - if res.is_ok() { - res.unwrap().execute(&mut lights); - } + pattern.iter() + .map(|x| parse_line(x)) + .for_each(|res| { + if res.is_ok() { + res.unwrap().execute(&mut lights); + } + }); } } diff --git a/src/util/pattern.rs b/src/util/pattern.rs index 30663eb..d9b3327 100644 --- a/src/util/pattern.rs +++ b/src/util/pattern.rs @@ -102,6 +102,10 @@ pub fn parse_line<'a>(v: Vec) -> Result>, ParseError pub fn format_multiline(input: &str) -> Vec> { input.lines() - .map(|x: &str| x.split_whitespace().collect::>()) + .map(|x: &str| + x.split_whitespace() + .map(|y| String::from(y)) + .collect::>() + ) .collect() } \ No newline at end of file