smpsc 0.1.2

Wrappers for tokio's mpsc channels which implement Stream and Sink.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub mod sink;
pub mod stream;

pub use sink::Sender;
pub use stream::Receiver;

/// Create a new oneshot channel, returning a [`Sender`] and a [`ReceiverStream`].
///
/// [`Sender`]: struct@Sender
/// [`ReceiverStream`]: struct@Receiver
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
    let (tx, rx) = tokio::sync::oneshot::channel();
    (Sender::new(tx), Receiver::new(rx))
}