pub struct SpscRing<T, const N: usize>(/* private fields */);Expand description
Constructor namespace for a bounded single-producer single-consumer ring.
N is the maximum supported capacity. Use Self::new to allocate a ring
with exactly N slots, or Self::with_capacity to choose a smaller
runtime capacity while keeping the type-level upper bound.
Implementations§
Source§impl<T, const N: usize> SpscRing<T, N>
impl<T, const N: usize> SpscRing<T, N>
Sourcepub fn new() -> (SpscProducer<T, N>, SpscConsumer<T, N>)
pub fn new() -> (SpscProducer<T, N>, SpscConsumer<T, N>)
Sourcepub fn with_capacity(
capacity: usize,
) -> (SpscProducer<T, N>, SpscConsumer<T, N>)
pub fn with_capacity( capacity: usize, ) -> (SpscProducer<T, N>, SpscConsumer<T, N>)
Creates a ring with a runtime capacity up to the type-level maximum N.
§Panics
Panics if capacity is 0 or larger than N.
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> Freeze for SpscRing<T, N>
impl<T, const N: usize> RefUnwindSafe for SpscRing<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for SpscRing<T, N>where
T: Send,
impl<T, const N: usize> Sync for SpscRing<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for SpscRing<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for SpscRing<T, N>
impl<T, const N: usize> UnwindSafe for SpscRing<T, N>where
T: UnwindSafe,
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