pub mod tcp;
pub use tcp::{TcpTransport, TcpTransportError};
use std::future::Future;
use yggr_core::{Incoming, Message, NodeId};
pub trait Transport<C>: Send + 'static
where
C: Send + 'static,
{
type Error: std::error::Error + Send + Sync + 'static;
fn send(
&self,
to: NodeId,
message: Message<C>,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn recv(&mut self) -> impl Future<Output = Option<Incoming<C>>> + Send;
fn shutdown(&mut self) -> impl Future<Output = ()> + Send {
async {}
}
}