Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl Input for &[T] where T : Clone #1831

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
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.

1 participant