Skip to content

Commit

Permalink
Merge pull request #317 from moenie99/patch-1
Browse files Browse the repository at this point in the history
feat(lib): impl Clone for SpannedIter
  • Loading branch information
jeertmans authored Jun 24, 2023
2 parents b1406db + 80bf838 commit e2702f6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions logos/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ pub struct SpannedIter<'source, Token: Logos<'source>> {
lexer: Lexer<'source, Token>,
}

// deriving Clone doesn't infer the necessary `Token::Extras: Clone` bound
impl<'source, Token> Clone for SpannedIter<'source, Token>
where
Token: Logos<'source> + Clone,
Token::Extras: Clone,
{
fn clone(&self) -> Self {
SpannedIter {
lexer: self.lexer.clone(),
}
}
}

impl<'source, Token> Iterator for SpannedIter<'source, Token>
where
Token: Logos<'source>,
Expand Down

0 comments on commit e2702f6

Please sign in to comment.