pub struct MpscQueue<T> { /* private fields */ }Expand description
Multiple-Producer Single-Consumer очередь
Реализована как lock-free очередь Майкла-Скотта. Производители никогда не блокируются, потребитель может ждать появления данных.
Implementations§
Source§impl<T> MpscQueue<T>
impl<T> MpscQueue<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Создать очередь с ограниченной ёмкостью
Sourcepub fn push(&self, value: T) -> QueueResult<()>
pub fn push(&self, value: T) -> QueueResult<()>
Добавить элемент (может вызываться из нескольких потоков)
Trait Implementations§
impl<T: Send> Send for MpscQueue<T>
impl<T: Send> Sync for MpscQueue<T>
Auto Trait Implementations§
impl<T> !Freeze for MpscQueue<T>
impl<T> RefUnwindSafe for MpscQueue<T>
impl<T> Unpin for MpscQueue<T>
impl<T> UnsafeUnpin for MpscQueue<T>
impl<T> UnwindSafe for MpscQueue<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