pub trait RbWrite<T>: RbBase<T> {
    // Required method
    unsafe fn set_tail(&self, value: usize);

    // Provided methods
    unsafe fn advance_tail(&self, count: usize) { ... }
    fn vacant_ranges(&self) -> (Range<usize>, Range<usize>) { ... }
    unsafe fn vacant_slices(
        &self
    ) -> (&mut [MaybeUninit<T>], &mut [MaybeUninit<T>]) { ... }
}
Expand description

Ring buffer write end.

Provides access to vacant memory and mechanism of item insertion.

It is recommended not to use this trait directly. Use Producer and Consumer instead.

Required Methods§

source

unsafe fn set_tail(&self, value: usize)

Sets the new tail position.

Safety

This call must cohere with ring buffer data modification.

It is recommended to use Self::advance_tail instead.

Provided Methods§

source

unsafe fn advance_tail(&self, count: usize)

Move tail position by count items forward.

Safety

First count items in vacant area must be de-initialized (dropped) before this call.

In debug mode panics if count is greater than number of vacant places in the ring buffer.

source

fn vacant_ranges(&self) -> (Range<usize>, Range<usize>)

Returns a pair of ranges of Self::vacant_slices location in underlying container.

source

unsafe fn vacant_slices(&self) -> (&mut [MaybeUninit<T>], &mut [MaybeUninit<T>])

Provides a direct access to the ring buffer vacant memory. Returns a pair of slices of uninitialized memory, the second one may be empty.

Safety

Vacant memory is uninitialized. Initialized items must be put starting from the beginning of first slice. When first slice is fully filled then items must be put to the beginning of the second slice.

This method must be followed by Self::advance_tail call with the number of items being put previously as argument. No other mutating calls allowed before that.

Implementors§

source§

impl<T, C: Container<T>> RbWrite<T> for LocalRb<T, C>

source§

impl<T, C: Container<T>> RbWrite<T> for SharedRb<T, C>

source§

impl<T, R: RbRef> RbWrite<T> for RbWriteCache<T, R>where R::Rb: RbWrite<T>,