Compare commits
1 commit
03726a9950
...
7ea486dea6
Author | SHA1 | Date | |
---|---|---|---|
7ea486dea6 |
2 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ fn main() {
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
let v: Vec<Box<dyn Pattern>> = res.unwrap();
|
let v: Vec<Box<dyn Pattern>> = res.unwrap();
|
||||||
for x in 0..v.len() {
|
for x in 0..v.len() {
|
||||||
lights = v[x].execute(&mut lights);
|
lights = *(v[x].execute(&mut lights));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<'a> TryFrom<Vec<String>> for Box<dyn Pattern<'a>> {
|
||||||
|
|
||||||
struct Unit;
|
struct Unit;
|
||||||
impl<'a> Pattern<'a> for Unit {
|
impl<'a> Pattern<'a> for Unit {
|
||||||
fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>) {
|
fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>) -> &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]> {
|
||||||
values
|
values
|
||||||
}
|
}
|
||||||
fn parse(_args: Vec<String>) -> Result<Self, ParseError> {
|
fn parse(_args: Vec<String>) -> Result<Self, ParseError> {
|
||||||
|
@ -40,7 +40,7 @@ struct Value {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Pattern<'a> for Value {
|
impl<'a> Pattern<'a> for Value {
|
||||||
fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>) {
|
fn execute(&self, values: &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]>) -> &'a mut RwLockWriteGuard<'_, [RawColor; crate::LED_SIZE]> {
|
||||||
for i in 0..crate::LED_SIZE {
|
for i in 0..crate::LED_SIZE {
|
||||||
let mut color: RawColor = (*values)[i];
|
let mut color: RawColor = (*values)[i];
|
||||||
if self.r.is_some() {
|
if self.r.is_some() {
|
||||||
|
|
Loading…
Reference in a new issue