Change BufMut methods that expose maybe-uninitialized bytes (#305)
- 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.
Showing
- src/buf/buf_mut.rs 72 additions, 24 deletionssrc/buf/buf_mut.rs
- src/buf/chain.rs 7 additions, 3 deletionssrc/buf/chain.rs
- src/buf/mod.rs 2 additions, 0 deletionssrc/buf/mod.rs
- src/bytes_mut.rs 7 additions, 16 deletionssrc/bytes_mut.rs
- src/either.rs 5 additions, 3 deletionssrc/either.rs
- tests/test_buf_mut.rs 5 additions, 12 deletionstests/test_buf_mut.rs
- tests/test_bytes.rs 10 additions, 0 deletionstests/test_bytes.rs
Loading
Please register or sign in to comment