pub unsafe fn write_with(
        &mut self,
        f: impl FnOnce(&mut GenericArray<MaybeUninit<W>, N>, usize) -> usize,
    ) {
        let count = f(&mut self.buf, self.len);
        self.len = if count + self.len > N::USIZE {
            N::USIZE
        } else {
            self.len + count
        }
    }
/// Gives the underling buffer to be modified and the already initialized length, the user is
/// is free to modify it, but must return the correct number of uninitialized elements that
/// were initialized.
///
/// # Safety
///
/// The user must provide the correct number of newer initialized elements, otherwise there will
/// be a risk of accessing uninitialized data, which is undefined behavior.
Gives the underling buffer to be modified and the already initialized length, the user is
is free to modify it, but must return the correct number of uninitialized elements that
were initialized.
Gives the underling buffer to be modified and the already initialized length the user is is free to modify it but must return the correct number of uninitialized elements that were initialized .
pub unsafe fn write_with(
        &mut self,
        f: impl FnOnce(&mut GenericArray<MaybeUninit<W>, N>, usize) -> usize,
    ) {
        let count = f(&mut self.buf, self.len);
        self.len = if count + self.len > N::USIZE {
            N::USIZE
        } else {
            self.len + count
        }
    }
pub unsafe fn write_with ( & mut self , f : impl FnOnce ( & mut GenericArray < MaybeUninit < W > , N > , usize ) -> usize , ) { let count = f ( & mut self . buf , self . len ) ; self . len = if count + self . len > N :: USIZE { N :: USIZE } else { self . len + count } }
Gives the underling buffer to be modified and the already initialized length, the user is
is free to modify it, but must return the correct number of uninitialized elements that
were initialized.
Gives the underling buffer to be modified and the already initialized length the user is is free to modify it but must return the correct number of uninitialized elements that were initialized .
&mut self
f
impl FnOnce(&mut GenericArray<MaybeUninit<W>, N>, usize) -> usize
&mut self
f
impl FnOnce(&mut GenericArray<MaybeUninit<W>, N>, usize) -> usize
safety
The user must provide the correct number of newer initialized elements, otherwise there will
be a risk of accessing uninitialized data, which is undefined behavior.
The user must provide the correct number of newer initialized elements otherwise there will be a risk of accessing uninitialized data which is undefined behavior .