Skip to main content

Crate concurrent_sharded_stack

Crate concurrent_sharded_stack 

Source
Expand description

A value-owning sharded stack backed by concurrent-intrusive-collections.

Values are LIFO within each shard; empty scans and close are not global atomic operations. The underlying intrusive nodes are private implementation details. Payloads require Send + 'static, but do not need Sync or Clone.

use concurrent_sharded_stack::{ConcurrentShardedStack, PopError};
let stack = ConcurrentShardedStack::with_concurrency(4);
stack.push(1).unwrap();
stack.push(2).unwrap();
assert_eq!(stack.pop(), Ok(2));
assert_eq!(stack.pop(), Ok(1));
assert_eq!(stack.pop(), Err(PopError::Empty));

Structs§

ConcurrentShardedStack
A value-owning concurrent stack with LIFO ordering within each shard.

Enums§

PopError
The result of an operation that did not find a node.
PushError
A rejected push, retaining ownership of the original value.