Struct work_queue::Queue [−][src]
A work queue.
This implements Clone
and so multiple handles to the queue can be easily created and
shared.
Implementations
impl<T> Queue<T>
[src]
pub fn new(local_queues: usize, local_queue_size: u16) -> Self
[src]
Create a new work queue.
local_queues
is the number of LocalQueue
s yielded by Self::local_queues
. Typically
you will have a local queue for each thread on a thread pool.
local_queue_size
is the number of items that can be stored in each local queue before it
overflows into the global one. You should fine-tune this to your needs.
Panics
This will panic if the local queue size is not a power of two.
Examples
use work_queue::Queue; let threads = 4; let queue: Queue<i32> = Queue::new(threads, 512);
pub fn push(&self, item: T)
[src]
Push an item to the global queue. When one of the local queues empties, they can pick this item up.
pub fn local_queues(&self) -> LocalQueues<'_, T>ⓘNotable traits for LocalQueues<'_, T>
impl<T> Iterator for LocalQueues<'_, T> type Item = LocalQueue<T>;
[src]
Notable traits for LocalQueues<'_, T>
impl<T> Iterator for LocalQueues<'_, T> type Item = LocalQueue<T>;
Trait Implementations
impl<T> Clone for Queue<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for Queue<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Queue<T>
impl<T> Send for Queue<T> where
T: Send,
T: Send,
impl<T> Sync for Queue<T> where
T: Send,
T: Send,
impl<T> Unpin for Queue<T>
impl<T> !UnwindSafe for Queue<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,