I was recently working with a Go project and a Rust project, and noticed that in Go's standard library there is a net.Conn
interface that represents "a generic stream-oriented network connection," such as a UDP connection, a TCP connection, or a TLS-over-TCP connection.
I'm wondering if there is something similar to this in Rust. I'm interested in the async ecosystem, so I looked at tokio::net::{TcpStream, UdpSocket}
and async_std::net::{TcpStream, UdpSocket}
, but they don't seem to implement some common trait.
If I want to abstract over at least the aforementioned three types of network connections, is there some abstraction like a trait in the stdlib or elsewhere that I can use?