Struct rtrb_basedrop::chunks::WriteChunk
source · [−]pub struct WriteChunk<'a, T: Send + 'static>(_, _);Expand description
Structure for writing into multiple (Default-initialized) slots in one go.
This is returned from Producer::write_chunk().
To obtain uninitialized slots, use Producer::write_chunk_uninit() instead,
which also allows moving items from an iterator into the ring buffer
by means of WriteChunkUninit::fill_from_iter().
Implementations
sourceimpl<T> WriteChunk<'_, T> where
T: Default + Send + 'static,
impl<T> WriteChunk<'_, T> where
T: Default + Send + 'static,
sourcepub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T])
pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T])
Returns two slices for writing to the requested slots.
All slots are initially filled with their Default value.
The first slice can only be empty if 0 slots have been requested.
If the first slice contains all requested slots, the second one is empty.
After writing to the slots, they are not automatically made available
to be read by the Consumer.
This has to be explicitly done by calling commit()
or commit_all().
If items are written but not committed afterwards,
they will not become available for reading and
they will be leaked (which is only relevant if T implements Drop).
sourcepub fn commit(self, n: usize)
pub fn commit(self, n: usize)
Makes the first n slots of the chunk available for reading.
The rest of the chunk is dropped.
Panics
Panics if n is greater than the number of slots in the chunk.
sourcepub fn commit_all(self)
pub fn commit_all(self)
Makes the whole chunk available for reading.
Trait Implementations
sourceimpl<'a, T: Debug + Send + 'static> Debug for WriteChunk<'a, T>
impl<'a, T: Debug + Send + 'static> Debug for WriteChunk<'a, T>
sourceimpl<T: Send + 'static> Drop for WriteChunk<'_, T>
impl<T: Send + 'static> Drop for WriteChunk<'_, T>
sourceimpl<'a, T> From<WriteChunkUninit<'a, T>> for WriteChunk<'a, T> where
T: Default + Send + 'static,
impl<'a, T> From<WriteChunkUninit<'a, T>> for WriteChunk<'a, T> where
T: Default + Send + 'static,
sourcefn from(chunk: WriteChunkUninit<'a, T>) -> Self
fn from(chunk: WriteChunkUninit<'a, T>) -> Self
Fills all slots with the Default value.
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for WriteChunk<'a, T>
impl<'a, T> Send for WriteChunk<'a, T>
impl<'a, T> !Sync for WriteChunk<'a, T>
impl<'a, T> Unpin for WriteChunk<'a, T> where
T: Unpin,
impl<'a, T> !UnwindSafe for WriteChunk<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more