pub struct Slots<'a, B> { /* private fields */ }Expand description
The slots of a vector that a writer fills in order: one call’s part of an extended vector, or the items that Slots::append adds.
Implementations§
Source§impl<B> Slots<'_, B>
impl<B> Slots<'_, B>
Sourcepub fn append<T>(
out: &mut Vec<B>,
n: usize,
write: impl FnOnce(&mut Slots<'_, B>) -> T,
) -> T
pub fn append<T>( out: &mut Vec<B>, n: usize, write: impl FnOnce(&mut Slots<'_, B>) -> T, ) -> T
Appends n items to out on this thread, and gives write’s result. write fills the slots in order. Where it leaves any unfilled, append panics and out keeps its length.
Sourcepub fn pairs<X: Copy, Y: Copy>(
&mut self,
x: Arg<'_, X>,
y: Arg<'_, Y>,
n: usize,
f: impl Fn(X, Y) -> (B, bool),
) -> bool
pub fn pairs<X: Copy, Y: Copy>( &mut self, x: Arg<'_, X>, y: Arg<'_, Y>, n: usize, f: impl Fn(X, Y) -> (B, bool), ) -> bool
Writes the n results of pairs after the items already written, on this thread, and gives whether every result succeeded. Panics where they don’t fit.
Sourcepub fn copy(&mut self, items: &[B])where
B: Copy,
pub fn copy(&mut self, items: &[B])where
B: Copy,
Writes items after the items already written, on this thread. Panics where they don’t fit.
Sourcepub unsafe fn fill(
&mut self,
n: usize,
write: impl FnOnce(&mut [MaybeUninit<B>]) -> bool,
) -> bool
pub unsafe fn fill( &mut self, n: usize, write: impl FnOnce(&mut [MaybeUninit<B>]) -> bool, ) -> bool
write’s result for the next n slots, which it must fill. They then count as written. Panics where they don’t fit.
§Safety
write must initialize every slot it receives before returning, whether it returns true or false.
Auto Trait Implementations§
impl<'a, B> !UnwindSafe for Slots<'a, B>
impl<'a, B> Forget for Slots<'a, B>
impl<'a, B> Freeze for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: Freeze,
impl<'a, B> RefUnwindSafe for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: RefUnwindSafe,
impl<'a, B> Send for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: Send,
impl<'a, B> Sync for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: Sync,
impl<'a, B> Unpin for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: Unpin,
impl<'a, B> UnsafeUnpin for Slots<'a, B>where
&'a mut [MaybeUninit<B>]: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more