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

Change BufMut methods that expose maybe-uninitialized bytes #305

Merged
merged 1 commit into from Oct 24, 2019

Conversation

seanmonstar
Copy link
Member

  • The return type of BufMut::bytes_mut is now
    &mut [MaybeUninit<u8>].
  • The argument type of BufMut::bytes_vectored_mut is now
    &mut [bytes::buf::IoSliceMut].
  • bytes::buf::IoSliceMut is a repr(transparent) wrapper around an
    std::io::IoSliceMut, but does not expose the inner bytes with a safe
    API, since they might be uninitialized.
  • BufMut::bytesMut and BufMut::bytes_vectored_mut are no longer
    unsafe fn, since the types encapsulate the unsafety instead.

- The return type of `BufMut::bytes_mut` is now
  `&mut [MaybeUninit<u8>]`.
- The argument type of `BufMut::bytes_vectored_mut` is now
  `&mut [bytes::buf::IoSliceMut]`.
- `bytes::buf::IoSliceMut` is a `repr(transparent)` wrapper around an
  `std::io::IoSliceMut`, but does not expose the inner bytes with a safe
  API, since they might be uninitialized.
- `BufMut::bytesMut` and `BufMut::bytes_vectored_mut` are no longer
  `unsafe fn`, since the types encapsulate the unsafety instead.
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 thanks.

@seanmonstar seanmonstar merged commit 2ac7233 into master Oct 24, 2019
@seanmonstar seanmonstar deleted the bufmut-maybe-uninit branch October 24, 2019 21:40
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.

None yet

2 participants