bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Safe method for creating UninitSlice

Open Rossterd opened this issue 2 years ago • 1 comments

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.

Rossterd avatar Jul 04 '22 23:07 Rossterd

Adding this seems fine to me.

Darksonn avatar Jul 05 '22 09:07 Darksonn