UninitWriteView

Struct UninitWriteView 

Source
pub struct UninitWriteView<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> {
    pub slices: (&'a mut [MaybeUninit<T>], &'a mut [MaybeUninit<T>]),
    /* private fields */
}
Expand description

View into the writable portion of the buffer, with uninitialized elements.

Using this is unsafe, as an accurate number of items produces must be given, otherwise this will produce uninitialized values to the consumer.

Fields§

§slices: (&'a mut [MaybeUninit<T>], &'a mut [MaybeUninit<T>])

Implementations§

Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> UninitWriteView<'a, T, PW, CW>

Source

pub unsafe fn produce(self, amnt: usize)

Produces the specified number of items, making them available to the receiver.

The remaining elements are assumed to be uninitialzed and will not be accessed.

amnt is clamped to the number of items in this view.

§Safety

The elements being produced must have been initialized.

Source

pub fn iter( &mut self, ) -> Chain<IterMut<'_, MaybeUninit<T>>, IterMut<'_, MaybeUninit<T>>>

Iterates through each available slot, in order.

Equivalent to chaining the two slice’s iterators.

Source

pub fn is_empty(&self) -> bool

Checks if the view is empty.

Equivalent to testing if the first slices is empty. If the first slice is empty, the second one will be as well.

Source

pub fn len(&self) -> usize

Gets the length of the view.

This is the sum of the lengths of both slices.

Source

pub fn get(&mut self, i: usize) -> Option<&mut MaybeUninit<T>>

Gets an item from the view, at the i’th place, or None if out of bounds.

Mimics slice::get_mut.

Trait Implementations§

Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> Deref for UninitWriteView<'a, T, PW, CW>

Source§

type Target = (&'a mut [MaybeUninit<T>], &'a mut [MaybeUninit<T>])

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> DerefMut for UninitWriteView<'a, T, PW, CW>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> Index<usize> for UninitWriteView<'a, T, PW, CW>

Source§

type Output = MaybeUninit<T>

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> IndexMut<usize> for UninitWriteView<'a, T, PW, CW>

Source§

fn index_mut(&mut self, i: usize) -> &mut MaybeUninit<T>

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a, T, PW, CW> Freeze for UninitWriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> RefUnwindSafe for UninitWriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> Send for UninitWriteView<'a, T, PW, CW>
where T: Send,

§

impl<'a, T, PW, CW> Sync for UninitWriteView<'a, T, PW, CW>
where T: Send + Sync,

§

impl<'a, T, PW, CW> Unpin for UninitWriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> !UnwindSafe for UninitWriteView<'a, T, PW, CW>

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<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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.