pub trait Conduit {
type Client;
type Server;
}
pub trait Node {
type Data;
}
pub trait Channel<T> {
type Recv: Node<Data = T>;
type Send: Node<Data = T>;
}
macro_rules! impl_node {
(@impl $t:ty) => {
impl<T> Node for $t {
type Data = T;
}
};
($($t:ty),* $(,)?) => {
$(impl_node!(@impl $t);)*
};
}
impl_node! {
std::sync::mpsc::Receiver<T>,
std::sync::mpsc::Sender<T>,
tokio::sync::broadcast::Receiver<T>,
tokio::sync::broadcast::Sender<T>,
tokio::sync::mpsc::Receiver<T>,
tokio::sync::mpsc::Sender<T>,
tokio::sync::mpsc::UnboundedReceiver<T>,
tokio::sync::mpsc::UnboundedSender<T>,
tokio::sync::oneshot::Receiver<T>,
tokio::sync::oneshot::Sender<T>,
tokio::sync::watch::Receiver<T>,
tokio::sync::watch::Sender<T>,
}