pub struct Buffer<const N: usize> { /* private fields */ }Expand description
A lock-free ring buffer.
The buffer has a fixed capacity N which must be a power of two.
It tracks the read and write positions using atomic counters.
Implementations§
Source§impl<const N: usize> Buffer<N>
impl<const N: usize> Buffer<N>
Sourcepub fn producer(&self) -> Producer<'_, N>
pub fn producer(&self) -> Producer<'_, N>
Returns a producer handle for this buffer.
The producer handles writing data into the buffer.
§Panics
Panics if a producer has already been created and not dropped.
Trait Implementations§
impl<const N: usize> Sync for Buffer<N>
Auto Trait Implementations§
impl<const N: usize> !Freeze for Buffer<N>
impl<const N: usize> !RefUnwindSafe for Buffer<N>
impl<const N: usize> Send for Buffer<N>
impl<const N: usize> Unpin for Buffer<N>
impl<const N: usize> UnwindSafe for Buffer<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more