Compare commits
1 commit
b9b1332814
...
9d39ce125a
Author | SHA1 | Date | |
---|---|---|---|
9d39ce125a |
2 changed files with 3 additions and 3 deletions
|
@ -35,8 +35,8 @@ fn main() {
|
|||
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() {
|
||||
res.unwrap().execute(&mut lights);
|
||||
}
|
||||
|
|
|
@ -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]>);
|
||||
|
|
Loading…
Reference in a new issue