Deadqueue Latest Version Build Status

Deadqueue is a dead simple async queue with back pressure support.

This crate provides three implementations:

Features

| Feature | Description | Extra dependencies | Default | | ------- | ----------- | ------------------ | ------- | | unlimited | Enable unlimited queue implementation | – | yes | | resizable | Enable resizable queue implementation | deadqueue/unlimited | yes | | limited | Enable limited queue implementation | – | yes |

Example

```rust,ignore use std::sync::Arc;

const TASKCOUNT: usize = 1000; const WORKERCOUNT: usize = 10;

type TaskQueue = deadqueue::limited::Queue;

[tokio::main]

async fn main() { let queue = Arc::new(TaskQueue::new(10)); for i in 0..TASKCOUNT { queue.push(i); } let mut futures = Vec::new(); for _ in 0..WORKERCOUNT { let queue = queue.clone(); futures.push(tokio::spawn(async move { let task = queue.pop().await; assert!(task > 1); })); } for future in futures { future.await; } assert_eq!(queue.len(), 0); } ```

License

Licensed under either of

at your option.