mpsc
English | 简体中文
mpsc provides Multiple Producer Single Consumer channels built on top of queue-ext. Supports multiple backing queue implementations, each with different characteristics.
Features
- SegQueue channel — lock-free, crossbeam-based (default)
- VecDeque channel — standard Rust VecDeque backed
- Priority channel — items prioritized by key order
- IndexMap channel — deduplication by key (last write wins)
- Thread-safe
Sender/Receivertypes - Single-threaded
LocalSender/LocalReceivervariants SinkandStreamtrait implementations- Type-erased channel API
Cargo Feature Flags
| Feature | Description | Default |
|---|---|---|
segqueue |
Lock-free channel via crossbeam::SegQueue |
yes |
vecdeque |
Channel backed by std::collections::VecDeque |
no |
priority |
Priority channel via box-collections::PriorityQueue |
no |
indexmap |
Deduplicating channel via indexmap::IndexMap |
no |
Basic Usage
use segqueue_channel;
use block_on;
let = segqueue_channel;
block_on.unwrap;
assert_eq!;
More Examples
Tests
37 tests covering all 4 channel types, LocalSender/Receiver, clone, and drop semantics.
License
Licensed under either of Apache License 2.0 or MIT license at your option.