From 0c828a8cf1711e887e4be8e25a3d84cfe6fe288d Mon Sep 17 00:00:00 2001 From: Jane Petrovna Date: Mon, 27 Dec 2021 19:09:59 -0500 Subject: [PATCH] now i am just writing things --- src/main.rs | 6 +++--- src/util/pattern.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 68d4bfa..8ad2ded 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,12 +32,12 @@ fn main() { }); loop { thread::sleep(time::Duration::from_millis(250)); - let mut lights = lock.write().unwrap(); let pattern = format_multiline("val 255 150 0"); pattern.iter() - .map(|x| parse_line(x)) - .for_each(|res| { + .map(|x: &Vec| parse_line((*x).clone())) + .for_each(|res: Result, ParseError>| { if res.is_ok() { + let mut lights = lock.write().unwrap(); res.unwrap().execute(&mut lights); } }); diff --git a/src/util/pattern.rs b/src/util/pattern.rs index d9b3327..ce732f1 100644 --- a/src/util/pattern.rs +++ b/src/util/pattern.rs @@ -5,7 +5,7 @@ use std::{ }; use std::sync::RwLockWriteGuard; -type ParseError = Box; +pub type ParseError = Box; pub trait Pattern<'a> { fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>);