pub struct ConcurrentRingBuffer<T>{ /* private fields */ }Expand description
Thread-safe wrapper for RingBuffer
Implementations§
Source§impl<T> ConcurrentRingBuffer<T>
impl<T> ConcurrentRingBuffer<T>
Sourcepub fn new(capacity: usize) -> ConcurrentRingBuffer<T>
pub fn new(capacity: usize) -> ConcurrentRingBuffer<T>
Create a new concurrent ring buffer
Sourcepub fn push(&self, item: T) -> bool
pub fn push(&self, item: T) -> bool
Push an item (returns true if not dropped, false if dropped due to full)
Sourcepub fn metrics(&self) -> Arc<RingBufferMetrics>
pub fn metrics(&self) -> Arc<RingBufferMetrics>
Get metrics
Sourcepub fn clone_ref(&self) -> ConcurrentRingBuffer<T>
pub fn clone_ref(&self) -> ConcurrentRingBuffer<T>
Cloneable reference
Auto Trait Implementations§
impl<T> Freeze for ConcurrentRingBuffer<T>
impl<T> !RefUnwindSafe for ConcurrentRingBuffer<T>
impl<T> Send for ConcurrentRingBuffer<T>
impl<T> Sync for ConcurrentRingBuffer<T>
impl<T> Unpin for ConcurrentRingBuffer<T>
impl<T> UnsafeUnpin for ConcurrentRingBuffer<T>
impl<T> !UnwindSafe for ConcurrentRingBuffer<T>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more