use tokio::task::JoinHandle; use std::net::SocketAddr; pub trait Stream { type Socket; fn recv(&mut self, buffer:&mut [u8]) -> Result; fn send(&mut self, buffer:&mut [u8]) -> Result<(), ()>; fn stream(&mut self) -> &mut Self::Socket; } pub trait Server { type Stream :Stream; fn bind(&mut self, interface:&str) -> impl std::future::Future>; //async fn accept(&self) -> Result; fn accept(&self, callback:F, args:Args) -> impl std::future::Future>,()>> where F: Fn(Self::Stream, SocketAddr, Args) -> Fut + Send + Sync + 'static, Fut: std::future::Future> + Send + 'static, Args: Send + 'static; fn close(&mut self); } pub mod tcp; pub mod tls; pub mod certstore;