Trait rtrb::CopyToUninit

source ·
pub trait CopyToUninit<T: Copy> {
    // Required method
    fn copy_to_uninit<'a>(&self, dst: &'a mut [MaybeUninit<T>]) -> &'a mut [T];
}
Expand description

Extension trait used to provide a copy_to_uninit() method on built-in slices.

This can be used to safely copy data to the slices returned from WriteChunkUninit::as_mut_slices().

To use this, the trait has to be brought into scope, e.g. with:

use rtrb::CopyToUninit;

Required Methods§

source

fn copy_to_uninit<'a>(&self, dst: &'a mut [MaybeUninit<T>]) -> &'a mut [T]

Copies contents to a possibly uninitialized slice.

Implementations on Foreign Types§

source§

impl<T: Copy> CopyToUninit<T> for [T]

source§

fn copy_to_uninit<'a>(&self, dst: &'a mut [MaybeUninit<T>]) -> &'a mut [T]

Copies contents to a possibly uninitialized slice.

§Panics

This function will panic if the two slices have different lengths.

Implementors§