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>
impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> UninitWriteView<'a, T, PW, CW>
Sourcepub unsafe fn produce(self, amnt: usize)
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.
Sourcepub fn iter(
&mut self,
) -> Chain<IterMut<'_, MaybeUninit<T>>, IterMut<'_, MaybeUninit<T>>>
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.
Sourcepub fn is_empty(&self) -> bool
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.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Gets the length of the view.
This is the sum of the lengths of both slices.
Sourcepub fn get(&mut self, i: usize) -> Option<&mut MaybeUninit<T>>
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.