[][src]Struct coco::deque::Worker

pub struct Worker<T> { /* fields omitted */ }

Worker side of a work-stealing deque.

There is only one worker per deque.

Methods

impl<T> Worker<T>[src]

pub 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);

pub fn push(&self, value: T)[src]

Pushes an element onto the bottom of the deque.

Examples

use coco::deque;

let (w, _) = deque::new();
w.push(1);
w.push(2);

pub fn pop(&self) -> Option<T>[src]

Pops an element from the bottom of the deque.

Examples

use coco::deque;

let (w, _) = deque::new();
w.push(1);
w.push(2);

assert_eq!(w.pop(), Some(2));
assert_eq!(w.pop(), Some(1));
assert_eq!(w.pop(), None);

pub fn steal(&self) -> Option<T>[src]

Steals an element from the top of the deque.

Examples

use coco::deque;

let (w, _) = deque::new();
w.push(1);
w.push(2);

assert_eq!(w.steal(), Some(1));
assert_eq!(w.steal(), Some(2));
assert_eq!(w.steal(), None);

Trait Implementations

impl<T: Send> Send for Worker<T>[src]

impl<T> Debug for Worker<T>[src]

Auto Trait Implementations

impl<T> !Sync for Worker<T>

impl<T> Unpin for Worker<T>

impl<T> UnwindSafe for Worker<T> where
    T: RefUnwindSafe

impl<T> RefUnwindSafe for Worker<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]