3 stable releases
new 1.2.0 | Mar 9, 2025 |
---|---|
1.1.0 | Jan 24, 2024 |
1.0.0 | Jan 23, 2024 |
#132 in Concurrency
4,276 downloads per month
Used in 13 crates
(2 directly)
12KB
220 lines
Ordered channel
An MPSC blocking channel that returns messages in sorted sequential consecutive order (explicitly assigned to each message), regardless of the order they were sent in.
It's convenient for collecting order-sensitive results of parallel operations (fork-join iteration).
It's backed by a BinaryHeap
that's used only when necessary to reorder the messages.
lib.rs
:
Equivalent of mpsc or crossbeam-channel, but allows sending messages with an index associated with them, to be delivered in the specific indexed order.
This enables performing multi-threaded work without accidentally reordering results.
Results are delivered as soon as possible, with minimal buffering. Items received out of order are temporarily kept in a binary heap.
Dependencies
~76KB