macro_rules! receiver_methods {
() => {
pub async fn recv(&mut self) -> Option<T> {
core::future::poll_fn(|cx| self.poll_recv(cx)).await
}
pub async fn recv_many(&mut self, buf: &mut Vec<T>, limit: usize) -> usize {
core::future::poll_fn(|cx| self.poll_recv_many(cx, buf, limit)).await
}
pub fn poll_recv(
&mut self,
cx: &mut core::task::Context<'_>,
) -> core::task::Poll<Option<T>> {
self.chan.poll_recv(cx)
}
pub fn poll_recv_many(
&mut self,
cx: &mut core::task::Context<'_>,
buf: &mut Vec<T>,
limit: usize,
) -> core::task::Poll<usize> {
self.chan.poll_recv_many(cx, buf, limit)
}
pub fn try_recv(&mut self) -> Result<T, crate::sync::mpsc::error::TryRecvError> {
self.chan.try_recv()
}
pub fn close(&mut self) {
self.chan.close_rx();
}
pub fn is_closed(&self) -> bool {
self.chan.rx_is_closed()
}
pub fn is_empty(&self) -> bool {
self.chan.len() == 0
}
pub fn len(&self) -> usize {
self.chan.len()
}
};
}
mod bounded;
mod chan;
mod unbounded;
pub use self::bounded::{Permit, Receiver, Sender, channel};
pub use self::unbounded::{UnboundedReceiver, UnboundedSender, unbounded_channel};