Priority Multi Consumer Multi Producer Channel
This is a quick and dirty implementation of a multi producer multi consumer channel for elements that implement the Ord trait, which gives the user two methods on the receiver: recv_greatest and recv_least.
Example
use pmpmc;
let = pmpmc;
let tx_new = tx.clone;
let rx_new = rx.clone;
let _ = spawn
.join;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
let tx_new = tx.clone;
let rx_new = rx.clone;
let _ = spawn
.join;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
I am using it for automatically scheduling tasks (workers now pull tasks off the channel in order of priority) but you can use it any time you want to push to a list from one or more threads and sort the list before receiving on another thread.
This crate is not optimized in any way, please don't use it in production. When I have time I may come back and make it more efficient and robust.