Generic-channel
Generic-channel provides common abstract traits [Sender
], [Receiver
] between several channel implementations that widely used in the Rust community.
Currently support channel implementations:
- std
- crossbeam-channel
- futures
NOTE: you need to enable those features in Cargo.toml
, use all
flag to enable all.
A handler function only wants to handle a sender or receiver to send/recv messages and do not care about the actual type or whether the sender is a crossbeam sender or a futures sender.
Examples
# extern crate generic_channel;
# extern crate crossbeam_channel;
use ;
// this method do not care about sender type.
// we can pass crossbeam channel to event_producer
let = ;
event_producer;
assert_eq!;
// we can also pass a std Sender or a futures Sender
let = ;
event_producer;
assert_eq!;
Documentation
License
MIT