fixes
This commit is contained in:
parent
23e4aa8471
commit
1f155bd231
1 changed files with 4 additions and 3 deletions
|
@ -8,11 +8,12 @@ type ParseError = Box<dyn std::error::Error>;
|
||||||
|
|
||||||
trait Pattern<'a> {
|
trait Pattern<'a> {
|
||||||
pub fn execute(&self, values: &'a mut [RawColor]);
|
pub fn execute(&self, values: &'a mut [RawColor]);
|
||||||
pub fn parse(args: Vec<String>) -> Result<Self, ParseError>;
|
pub fn parse(args: Vec<String>) -> Result<Self, ParseError> where Self: Sized;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TryFrom<Vec<String>> for Box<dyn Pattern<'a>> {
|
impl<'a> TryFrom<Vec<String>> for Box<dyn Pattern<'a>> {
|
||||||
fn try_from(s: Vec<String>) -> Result<Self, ParseError> {
|
type Error = ParseError;
|
||||||
|
fn try_from(s: Vec<String>) -> Result<Self, Error> {
|
||||||
match s[0].as_str() {
|
match s[0].as_str() {
|
||||||
"unit" => Unit::parse(s),
|
"unit" => Unit::parse(s),
|
||||||
"val" => Value::parse(s),
|
"val" => Value::parse(s),
|
||||||
|
|
Loading…
Reference in a new issue