This will allow using BufMut without having to initialise memory
first. In particular, this will allow simple integration with tokio:
#![feature(maybe_uninit_slice)]
use tokio::io::AsyncReadExt;
let mut tokio_file = /* ... */;
let mut buf = [MaybeUninit::uninit(); 4096];
let len = tokio_file.read_buf(&mut &mut buf[..]);
// SAFETY: read initialised first len bytes of the buffer.
let buf = unsafe {
MaybeUninit::slice_assume_init_mut(&buf[..len])
};
This will allow using BufMut without having to initialise memory first. In particular, this will allow simple integration with tokio: