test collect
This commit is contained in:
parent
0c828a8cf1
commit
1e6f006e10
1 changed files with 11 additions and 8 deletions
19
src/main.rs
19
src/main.rs
|
@ -32,14 +32,17 @@ fn main() {
|
||||||
});
|
});
|
||||||
loop {
|
loop {
|
||||||
thread::sleep(time::Duration::from_millis(250));
|
thread::sleep(time::Duration::from_millis(250));
|
||||||
let pattern = format_multiline("val 255 150 0");
|
let mut lights = lock.write().unwrap();
|
||||||
pattern.iter()
|
let pattern = format_multiline("unit");
|
||||||
|
let res: Result<Vec<Box<dyn Pattern>>> = pattern.iter()
|
||||||
.map(|x: &Vec<String>| parse_line((*x).clone()))
|
.map(|x: &Vec<String>| parse_line((*x).clone()))
|
||||||
.for_each(|res: Result<Box<dyn Pattern>, ParseError>| {
|
.collect();
|
||||||
if res.is_ok() {
|
|
||||||
let mut lights = lock.write().unwrap();
|
if res.is_ok() {
|
||||||
res.unwrap().execute(&mut lights);
|
let v: Vec<Box<dyn Pattern>> = res.unwrap();
|
||||||
}
|
for x in 0..v.len() {
|
||||||
});
|
v[x].execute(&mut lights);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue