| Crates.io | priority-channel |
| lib.rs | priority-channel |
| version | 0.1.1 |
| created_at | 2026-01-16 05:46:44.809042+00 |
| updated_at | 2026-01-16 05:49:17.735346+00 |
| description | An async channel supporting priority, allowing stealing and preserving the message order. |
| homepage | https://github.com/wtdcode/priority-channel-rs |
| repository | https://github.com/wtdcode/priority-channel-rs |
| max_upload_size | |
| id | 2047965 |
| size | 31,840 |
Yet another async priority channel implementation.
Features:
BinaryHeap, priority-channel wraps a BtreeMap<P, VecDequeue<V>> which preserves the order of messages with the same priority.tokio.The tests are borrowed from async-priority-channel and most usages could refer to async-channel.
Sample:
async fn test_send_recv_2() {
let (tx, rx) = bounded(3);
tx.send(1, 1).await.unwrap();
tx.send(3, 3).await.unwrap();
tx.send(2, 2).await.unwrap();
assert_eq!(rx.recv().await.unwrap(), (3, 3));
assert_eq!(rx.recv().await.unwrap(), (2, 2));
assert_eq!(rx.recv().await.unwrap(), (1, 1));
}