sensorial-systems / ligen

Apache License 2.0
19 stars 3 forks source link

Parser trait should be renamed to Transformer trait #125

Open notdanilo opened 11 months ago

notdanilo commented 11 months ago

Rename Parser to Transformer and implement Parser as a specialization of Transformer where the Input is a string.

trait Transformer<Input> {
  type Output;
  fn transform(&self, input: Input) -> Result<Self::Output>;
}

trait Parser<T>: Transformer<&str, Output = T> {
  fn parse(&self, &str) -> Result<Self::Output>;
}