fixes
This commit is contained in:
parent
6508fe03e2
commit
23e4aa8471
1 changed files with 7 additions and 7 deletions
|
@ -7,8 +7,8 @@ use std::{
|
||||||
type ParseError = Box<dyn std::error::Error>;
|
type ParseError = Box<dyn std::error::Error>;
|
||||||
|
|
||||||
trait Pattern<'a> {
|
trait Pattern<'a> {
|
||||||
fn execute(&self, values: &'a mut [RawColor]);
|
pub fn execute(&self, values: &'a mut [RawColor]);
|
||||||
fn parse(args: Vec<String>) -> Result<Self, ParseError>;
|
pub fn parse(args: Vec<String>) -> Result<Self, ParseError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TryFrom<Vec<String>> for Box<dyn Pattern<'a>> {
|
impl<'a> TryFrom<Vec<String>> for Box<dyn Pattern<'a>> {
|
||||||
|
@ -48,7 +48,7 @@ impl<'a> Pattern<'a> for Value {
|
||||||
if self.b.is_some() {
|
if self.b.is_some() {
|
||||||
color[0] = self.b.unwrap();
|
color[0] = self.b.unwrap();
|
||||||
}
|
}
|
||||||
values[i]
|
values[i] = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn parse(args: Vec<String>) -> Result<Self, ParseError> {
|
fn parse(args: Vec<String>) -> Result<Self, ParseError> {
|
||||||
|
@ -57,9 +57,9 @@ impl<'a> Pattern<'a> for Value {
|
||||||
let param3 = args[2].parse::<u8>();
|
let param3 = args[2].parse::<u8>();
|
||||||
if param1.is_ok() && param2.is_ok() && param3.is_ok() {
|
if param1.is_ok() && param2.is_ok() && param3.is_ok() {
|
||||||
Ok(Value{
|
Ok(Value{
|
||||||
r: param1.unwrap(),
|
r: Some(param1.unwrap()),
|
||||||
g: param2.unwrap(),
|
g: Some(param2.unwrap()),
|
||||||
b: param3.unwrap()
|
b: Some(param3.unwrap())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -87,7 +87,7 @@ impl<'a> Pattern<'a> for Value {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err() => Err()
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue