use crate::error::Result;
use tokio::io::{AsyncRead, AsyncWrite};
pub mod mem;
#[cfg(feature = "quic")]
pub mod quic;
pub type BoxSend = Box<dyn AsyncWrite + Unpin + Send>;
pub type BoxRecv = Box<dyn AsyncRead + Unpin + Send>;
#[async_trait::async_trait]
pub trait Transport: Send + Sync + 'static {
async fn open_uni(&self) -> Result<BoxSend>;
async fn accept_uni(&self) -> Result<BoxRecv>;
async fn open_bi(&self) -> Result<(BoxSend, BoxRecv)>;
async fn accept_bi(&self) -> Result<(BoxSend, BoxRecv)>;
fn close(&self, code: u32, reason: &[u8]);
fn peer_label(&self) -> String {
"peer".to_string()
}
fn bytes_sent(&self) -> Option<u64> {
None
}
}