Problem with lifetimes and traits
The Rust Programming Language Forum
Problem with lifetimes and traits
I keep getting problems with lifetimes when I use a trait, but not when I directly use a type that implements the trait. I have recreated the problem in a few lines of code, with the inferred types shown. struct Token<'src> { slice: &'src str, } fn lex<'src>(source: &'src str) -> Vec<Token<'src>> { vec![] } struct Parser<'a, 'src> { tokens: &'a [Token<'src>], } trait Parse<'a, 'src> { fn parse(parser: &mut Parser<'a, 'src>) -> Self; } struct Node<'src> { slice: &'src st...
0 comments
No comments yet.