Struct coco::deque::Stealer
[−]
[src]
pub struct Stealer<T> { /* fields omitted */ }
Stealer side of a work-stealing deque.
Stealers may be cloned in order to create more stealers for the same deque.
Methods
impl<T> Stealer<T>
[src]
fn len(&self) -> usize
[src]
Returns the number of elements in the deque.
If used concurrently with other operations, the returned number is just an estimate.
Examples
use coco::deque; let (w, _) = deque::new(); for i in 0..30 { w.push(i); } assert_eq!(w.len(), 30);
fn steal(&self) -> Option<T>
[src]
Steals an element from the top of the deque.
Examples
use coco::deque; let (w, s) = deque::new(); w.push(1); w.push(2); assert_eq!(s.steal(), Some(1)); assert_eq!(s.steal(), Some(2)); assert_eq!(s.steal(), None);
fn steal_weak(&self) -> Steal<T>
[src]
Steals an element from the top of the deque, but may sometimes spuriously fail.
If another concurrent operation gets in the way when stealing data, this method will return
immediately with Steal::Inconsistent
instead of retrying.
Examples
use coco::deque::{self, Steal}; let (w, s) = deque::new(); w.push(1); assert_eq!(s.steal_weak(), Steal::Data(1));
Trait Implementations
impl<T: Send> Send for Stealer<T>
[src]
impl<T: Send> Sync for Stealer<T>
[src]
impl<T> Clone for Stealer<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more