Compare commits

..

1 commit

Author SHA1 Message Date
7ea486dea6 ret 2021-12-28 15:08:05 -05:00
2 changed files with 3 additions and 3 deletions

View file

@ -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));
} }
} }
} }

View file

@ -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() {