explicitly make Connect implement the Transport

This commit is contained in:
Dirkjan Ochtman
2020-10-14 14:24:38 +02:00
committed by Benjamin Fry
parent 587273247e
commit 4ee7ffadfd
8 changed files with 61 additions and 129 deletions

View File

@@ -37,9 +37,7 @@ pub struct AsyncStdTcpStream(async_std::net::TcpStream);
#[async_trait]
impl Connect for AsyncStdTcpStream {
type Transport = AsyncStdTcpStream;
async fn connect(addr: SocketAddr) -> io::Result<Self::Transport> {
async fn connect(addr: SocketAddr) -> io::Result<Self> {
let stream = async_std::net::TcpStream::connect(addr).await?;
stream.set_nodelay(true)?;
Ok(AsyncStdTcpStream(stream))