diff --git a/src/main.rs b/src/main.rs index 5611d90..e354b99 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,7 +41,7 @@ fn main() { if res.is_ok() { let v: Vec> = res.unwrap(); for x in 0..v.len() { - lights = v[x].execute(&mut lights); + lights = *(v[x].execute(&mut lights)); } } } diff --git a/src/util/pattern.rs b/src/util/pattern.rs index dbe9520..4f42ff9 100644 --- a/src/util/pattern.rs +++ b/src/util/pattern.rs @@ -25,7 +25,7 @@ impl<'a> TryFrom> for Box> { struct 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 } fn parse(_args: Vec) -> Result { @@ -40,7 +40,7 @@ struct 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 { let mut color: RawColor = (*values)[i]; if self.r.is_some() {