use std::future::Future;
pub(crate) mod quic;
pub(crate) trait SyncStream: Send + Sync + 'static {
type Error: std::error::Error + Send + Sync + 'static;
fn peer(&self) -> super::SyncPeer;
fn send(&mut self, data: &[u8]) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn receive(
&mut self,
buffer: &mut [u8],
) -> impl Future<Output = Result<usize, Self::Error>> + Send;
fn finish(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
pub(crate) trait SyncConnector: Send + Sync + 'static {
type Error: std::error::Error + Send + Sync + 'static;
type Stream: SyncStream<Error = Self::Error>;
async fn connect(&self, peer: super::SyncPeer) -> Result<Self::Stream, Self::Error>;
}
pub(crate) trait SyncListener: Send + Sync + 'static {
type Stream: SyncStream;
fn local_addr(&self) -> super::Addr;
async fn accept(&mut self) -> Option<Self::Stream>;
}