Skip to main content

Slots

Struct Slots 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.