Change Bytes::make_mut to impl From<Bytes> for BytesMut#710
Merged
Darksonn merged 1 commit intotokio-rs:masterfrom May 28, 2024
Merged
Change Bytes::make_mut to impl From<Bytes> for BytesMut#710Darksonn merged 1 commit intotokio-rs:masterfrom
Darksonn merged 1 commit intotokio-rs:masterfrom
Conversation
…-rs#709) <Arc<T>>::make_mut returns a &mut T, such an API is doable for Bytes too and thus we should reserve Bytes::make_mut for that. Furthermore, it would be helpful to use From<Bytes> as a trait bound in some cases with other traits such as Hyper's body trait, where Hyper gives you Bytes values. Finally, making it impl From<Bytes> for BytesMut means the API is more easily discoverable as it appears on both Bytes and BytesMut.
Member
|
(The marker for what issue you're closing should go in the issue text, not the title. Otherwise github will not auto-close it when I merge the PR.) |
A5rocks
reviewed
Jul 8, 2024
Contributor
There was a problem hiding this comment.
Was this missed in review? I don't see any reason for this file.
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<Arc<T>>::make_mutreturns a&mut T, such an API is doable forBytestoo and thus we should reserveBytes::make_mutfor that.Furthermore, it would be helpful to use
From<Bytes>as a trait bound in some cases with other traits such as Hyper's body trait, where Hyper gives youBytesvalues.Finally, making it impl
From<Bytes>forBytesMutmeans the API is more easily discoverable as it appears on bothBytesandBytesMut.Closes: #709