Move IntoByteSlice[Mut]: Into into methods#1299
Merged
Conversation
1e4cc98 to
877af9f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1299 +/- ##
==========================================
+ Coverage 87.79% 87.86% +0.06%
==========================================
Files 15 15
Lines 5171 5199 +28
==========================================
+ Hits 4540 4568 +28
Misses 631 631 ☔ View full report in Codecov by Sentry. |
Remove the `Into<&[u8]>` and `Into<&mut [u8]>` bounds on `IntoByteSlice` and `IntoByteSliceMut` and replace them with methods. This allows `IntoByteSlice` to be implemented for `&mut [u8]` (and, as a consequence, permits `Ref::<&mut [u8], _>::into_ref`), which was previously barred. Closes #1260
877af9f to
4f92091
Compare
jswrenn
approved these changes
May 18, 2024
| unsafe impl<'a> IntoByteSlice<'a> for &'a [u8] { | ||
| #[inline(always)] | ||
| fn into_byte_slice(self) -> &'a [u8] { | ||
| // SAFETY: It would be patently insane to implement `<Deref for |
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.
Remove the
Into<&[u8]>andInto<&mut [u8]>bounds onIntoByteSliceandIntoByteSliceMutand replace them with methods. This allowsIntoByteSliceto be implemented for&mut [u8](and, as a consequence, permitsRef::<&mut [u8], _>::into_ref), which was previously barred.Closes #1260