now i am just writing things

This commit is contained in:
jane 2021-12-27 19:09:59 -05:00
parent 2de3ecde06
commit 0c828a8cf1
2 changed files with 4 additions and 4 deletions

View file

@ -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<String>| parse_line((*x).clone()))
.for_each(|res: Result<Box<dyn Pattern>, ParseError>| {
if res.is_ok() {
let mut lights = lock.write().unwrap();
res.unwrap().execute(&mut lights);
}
});

View file

@ -5,7 +5,7 @@ use std::{
};
use std::sync::RwLockWriteGuard;
type ParseError = Box<dyn std::error::Error>;
pub type ParseError = Box<dyn std::error::Error>;
pub trait Pattern<'a> {
fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>);