Skip to content

Conversation

asibahi
Copy link

@asibahi asibahi commented Feb 25, 2025

Hello.

This is not related to a specific issue, tho I thought to do this as an alternate implementation of #1810 , and I mentioned it in #1809 .

This generalizes Input implementation over any type that implements Clone. Which includes u8 as well as custom lexed Token types common in parsers.

My understanding is that any type that implements Copy, when clone() is called on it, just .. copies. No additional performance overhead. I would make this as a separate implementation from &[u8] but you'd run into specialization.

All the tests pass with no changes to them whatsoever.

@asibahi asibahi requested a review from Geal as a code owner February 25, 2025 22:42
@autumnull
Copy link

This would be really useful, I am currently writing a lexer and parser with nom and really don't want to write the boilerplate for this 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants