Crates.io | conqueue |
lib.rs | conqueue |
version | 0.4.0 |
source | src |
created_at | 2019-07-30 23:51:01.589305 |
updated_at | 2021-01-24 20:33:32.307907 |
description | Yet another multi-producer, single-consumer queue (MPSC) |
homepage | https://github.com/longshorej/conqueue |
repository | https://github.com/longshorej/conqueue |
max_upload_size | |
id | 153102 |
size | 16,742 |
Conqueue is yet another multi-producer, single-consumer queue (MPSC) for the Rust programming language.
To get started, add the following to your Cargo.toml
file:
[dependencies]
conqueue = "0.4.0"
Then, at the root of your crate:
extern crate conqueue
Finally, create a sender/receiver pair. The sender may be cloned to
allow concurrent producers, and it is both Send
and Sync
. The
receiver is Send
so it may be moved to other threads.
let (tx1, mut rx) = conqueue::Queue::unbounded();
let tx2 = tx1.clone();
tx1.push(1);
tx2.push(2);
while let Some(value) = rx.pop() {
println!("popped: {}", value);
}
Sync
, Send
trait bounds for QueueSender
, QueueReceiver
, thanks to @JOE1994Send
To run the tests, execute the following:
cargo test
To run a benchmark for the queue, execute the following:
cargo test --release -- --ignored --nocapture
To release the create, perform the following:
Cargo.toml
, bumping the version as appropriate.README.md
, adding an entry to the Release Notes, and updating the TOML snippet's version.master
.This code is largely based on majek's implementation of Michael-Scott queue. You can find the code here and a blog post here.
Conqueue is provided under the MIT license.