pub struct SpscRing<T> { /* private fields */ }Expand description
A wait-free SPSC ring buffer in a shared memory region.
This is a convenience wrapper around SpscRingRaw<T> that manages
memory through a Region. All operations delegate to the raw implementation.
Implementations§
Source§impl<T: Copy> SpscRing<T>
impl<T: Copy> SpscRing<T>
Sourcepub unsafe fn init(region: Region, header_offset: usize, capacity: u32) -> Self
pub unsafe fn init(region: Region, header_offset: usize, capacity: u32) -> Self
Initialize a new ring in the region.
§Safety
The region must be writable and exclusively owned during initialization.
Sourcepub unsafe fn attach(region: Region, header_offset: usize) -> Self
pub unsafe fn attach(region: Region, header_offset: usize) -> Self
Attach to an existing ring in the region.
§Safety
The region must contain a valid, initialized ring header.
Sourcepub fn inner(&self) -> &SpscRingRaw<T>
pub fn inner(&self) -> &SpscRingRaw<T>
Get a reference to the inner raw ring.
Sourcepub fn split(&self) -> (SpscProducer<'_, T>, SpscConsumer<'_, T>)
pub fn split(&self) -> (SpscProducer<'_, T>, SpscConsumer<'_, T>)
Split into producer and consumer handles.
Sourcepub fn status(&self) -> RingStatus
pub fn status(&self) -> RingStatus
Returns a status snapshot of head/tail.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SpscRing<T>
impl<T> RefUnwindSafe for SpscRing<T>where
T: RefUnwindSafe,
impl<T> Unpin for SpscRing<T>
impl<T> UnwindSafe for SpscRing<T>where
T: RefUnwindSafe,
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