Comment on Sans-IO: The secret to effective Rust for network servicesparentComments−joshka2yhttps://news.ycombinator.com/item?id=40879547 async fn stun( server: SocketAddr, mut socket: impl Sink<(BindingRequest, SocketAddr), Error = color_eyre::Report> + Stream<Item = Result<(BindingResponse, SocketAddr), color_eyre::Report>> + Unpin + Send + 'static, ) -> Result<SocketAddr> { socket.send((BindingRequest, server)).await?; let (message, _server) = socket.next().await.ok_or_eyre("No response")??; Ok(message.address) } Fully working code at https://gist.github.com/joshka/af299be87dbd1f64060e47227b577...
Comments
https://news.ycombinator.com/item?id=40879547
Fully working code at https://gist.github.com/joshka/af299be87dbd1f64060e47227b577...