Struct coco::stack::Stack [] [src]

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

A lock-free stack.

It can be used with multiple producers and multiple consumers at the same time.

Methods

impl<T> Stack<T>
[src]

Returns a new, empty stack.

Examples

use coco::Stack;

let s = Stack::<i32>::new();

Returns true if the stack is empty.

Examples

use coco::Stack;

let s = Stack::new();
assert!(s.is_empty());
s.push("hello");
assert!(!s.is_empty());

Pushes a new value onto the stack.

Examples

use coco::Stack;

let s = Stack::new();
s.push(1);
s.push(2);

Attemps to pop an value from the stack.

Returns None if the stack is empty.

Examples

use coco::Stack;

let s = Stack::new();
s.push(1);
s.push(2);
assert_eq!(s.pop(), Some(2));
assert_eq!(s.pop(), Some(1));
assert_eq!(s.pop(), None);

Trait Implementations

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

impl<T: Send> Sync for Stack<T>
[src]

impl<T> Drop for Stack<T>
[src]

A method called when the value goes out of scope. Read more