define DnsTcpStream supertrait for Connect
This commit is contained in:

committed by
Benjamin Fry

parent
ab46adcc09
commit
c4d254b49b
@@ -11,7 +11,7 @@ use std::pin::Pin;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use futures_io::{AsyncRead, AsyncWrite};
|
||||
use trust_dns_resolver::proto::tcp::Connect;
|
||||
use trust_dns_resolver::proto::tcp::{Connect, DnsTcpStream};
|
||||
use trust_dns_resolver::proto::udp::UdpSocket;
|
||||
|
||||
use crate::time::AsyncStdTime;
|
||||
@@ -37,10 +37,12 @@ impl UdpSocket for AsyncStdUdpSocket {
|
||||
|
||||
pub struct AsyncStdTcpStream(async_std::net::TcpStream);
|
||||
|
||||
impl DnsTcpStream for AsyncStdTcpStream {
|
||||
type Time = AsyncStdTime;
|
||||
}
|
||||
|
||||
#[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)?;
|
||||
|
Reference in New Issue
Block a user