Struct reth_util::queue::AsyncQueue
source · [−]pub struct AsyncQueue<ITEM> where
ITEM: 'static + Send, { /* private fields */ }
Expand description
AsyncQueue is queue that uses Condvar to signal between two threads.
Implementations
sourceimpl<ITEM> AsyncQueue<ITEM> where
ITEM: 'static + Send,
impl<ITEM> AsyncQueue<ITEM> where
ITEM: 'static + Send,
sourcepub fn new(max_items: usize, batch_size: usize) -> Self
pub fn new(max_items: usize, batch_size: usize) -> Self
Create new AsyncQueue. limit number of items with max_items
sourcepub fn enqueue(&self, item: ITEM) -> bool
pub fn enqueue(&self, item: ITEM) -> bool
Add items to qeuue and notify waiting wait_for_item
calls
sourcepub fn wait_for_batch(&self) -> Option<Vec<ITEM>>
pub fn wait_for_batch(&self) -> Option<Vec<ITEM>>
if there is items in queue return first item otherwise wait for condvar notification
Auto Trait Implementations
impl<ITEM> !RefUnwindSafe for AsyncQueue<ITEM>
impl<ITEM> Send for AsyncQueue<ITEM>
impl<ITEM> Sync for AsyncQueue<ITEM>
impl<ITEM> Unpin for AsyncQueue<ITEM> where
ITEM: Unpin,
impl<ITEM> UnwindSafe for AsyncQueue<ITEM>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more