[−][src]Struct coco::deque::Worker
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
Auto Trait Implementations
impl<T> !Sync for Worker<T>
impl<T> Unpin for Worker<T>
impl<T> UnwindSafe for Worker<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> RefUnwindSafe for Worker<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,