bytes
bytes copied to clipboard
Safe method for creating UninitSlice
When implementing BufMut
the BufMut::chunk_mut
method requires you to return an UninitSlice
instance.
As UninitSlice
only has the unsafe from_raw_parts()
constructor, this means that even if your slice is definitely already initiated you still need to write unsafe code to return this slice.
This isn't great, and it would be nice to have a way to safely create a UninitSlice from a slice of already initiated data.
Adding this seems fine to me.