associate Time type with Connect trait

This commit is contained in:
Dirkjan Ochtman
2020-10-14 14:41:20 +02:00
committed by Benjamin Fry
parent 2764de2260
commit ab46adcc09
11 changed files with 52 additions and 55 deletions

View File

@@ -14,6 +14,8 @@ use futures_io::{AsyncRead, AsyncWrite};
use trust_dns_resolver::proto::tcp::Connect;
use trust_dns_resolver::proto::udp::UdpSocket;
use crate::time::AsyncStdTime;
pub struct AsyncStdUdpSocket(async_std::net::UdpSocket);
#[async_trait]
@@ -37,6 +39,8 @@ pub struct AsyncStdTcpStream(async_std::net::TcpStream);
#[async_trait]
impl Connect for AsyncStdTcpStream {
type Time = AsyncStdTime;
async fn connect(addr: SocketAddr) -> io::Result<Self> {
let stream = async_std::net::TcpStream::connect(addr).await?;
stream.set_nodelay(true)?;