Hello,
I have a trait that is used to parse tree:
pub trait FromPairs {
fn parse(pairs: Pairs<'_, Rule>) -> Result<Self,Error>;
}
impl <T: FromStr> FromPairs for T {
fn parse(mut pairs: Pairs<'_, Rule>) -> Result<Self, Error> {
pairs.get_str().parse()
}
}
impl <T: FromPairs> FromPairs for Vec<T> {
fn parse(mut pairs: Pairs<'_, Rule>) -> Result<Self, Error> {
pairs.map(|x| x.into_inner().parse()).collect()
}
}
And I get the following error:
I would like to have only one trait and no need for a Wrapper around Vec.
Is this possible?
Thanks for reading.
ccgauche.