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

Add get_array method to Buf #781

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

lperlaki
Copy link

This would increase the MSRV to 1.51 since it uses const generics!

I am not sure on the MSRV policy of bytes, so if this is a problem we can just close this PR

Added Methods

  • Buf::try_get_array
    is a copy of the old implementation of buf_try_get_impl
  • Buf::get_array simply calls try_get_array and panic_advance on error

the second commit changes the implementation of the get_x methods to use try_get_array

this would also enable Buf implementors to optimise (like #622) the get_x methods by overriding try_get_array

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