pub struct SliceWriter<'a, T> { /* private fields */ }Expand description
Utility for incrementally filling an uninitialized slice, one SIMD vector at a time.
Implementations§
Source§impl<'a, T: Elem> SliceWriter<'a, T>
impl<'a, T: Elem> SliceWriter<'a, T>
Sourcepub fn new(buf: &'a mut [MaybeUninit<T>]) -> Self
pub fn new(buf: &'a mut [MaybeUninit<T>]) -> Self
Create a writer which initializes elements of buf.
Sourcepub fn write_vec<O: BitOps<T>>(&mut self, ops: O, xs: O::Simd)
pub fn write_vec<O: BitOps<T>>(&mut self, ops: O, xs: O::Simd)
Initialize the next ops.len() elements of the slice from the contents
of SIMD vector xs.
Panics if the slice does not have space for ops.len() elements.
Sourcepub fn write_vecs<O: BitOps<T>, const N: usize>(
&mut self,
ops: O,
xs: [O::Simd; N],
)
pub fn write_vecs<O: BitOps<T>, const N: usize>( &mut self, ops: O, xs: [O::Simd; N], )
Initialize the next N * ops.len() elements of the slice from the
contents of the SIMD vectors xs.
This is equivalent to calling write_vec for each
vector, but performs a single bounds check for the whole batch, which is
useful when writing several vectors per loop iteration.
Panics if the slice does not have space for N * ops.len() elements.
Sourcepub fn write_scalar(&mut self, x: T)
pub fn write_scalar(&mut self, x: T)
Initialize the next element of the slice from x.
Panics if the slice does not have space for writing any more elements.
Sourcepub fn into_mut_slice(self) -> &'a mut [T]
pub fn into_mut_slice(self) -> &'a mut [T]
Finish writing the slice and return the initialized portion.