diff --git a/src/util/pattern.rs b/src/util/pattern.rs index a857bff..7ea35d6 100644 --- a/src/util/pattern.rs +++ b/src/util/pattern.rs @@ -8,11 +8,12 @@ type ParseError = Box; trait Pattern<'a> { pub fn execute(&self, values: &'a mut [RawColor]); - pub fn parse(args: Vec) -> Result; + pub fn parse(args: Vec) -> Result where Self: Sized; } impl<'a> TryFrom> for Box> { - fn try_from(s: Vec) -> Result { + type Error = ParseError; + fn try_from(s: Vec) -> Result { match s[0].as_str() { "unit" => Unit::parse(s), "val" => Value::parse(s), @@ -96,4 +97,4 @@ impl<'a> Pattern<'a> for Value { pub fn parse_line(v: Vec) -> Result>, ParseError> { let res: Result, ParseError> = v.try_into(); res -} \ No newline at end of file +}