Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BufMut for &mut [MaybeUninit<u8>] #597

Merged
merged 1 commit into from
Feb 10, 2023
Merged

Commits on Feb 9, 2023

  1. 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])
        };
    mina86 committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    f9ca1ef View commit details
    Browse the repository at this point in the history