-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement BufMut for
&mut [MaybeUninit<u8>]
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]) };
- Loading branch information
Showing
2 changed files
with
143 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters