use super::Connector; use crate::common::TcpTransport; use async_trait::async_trait; use std::io; use tokio::net::ToSocketAddrs; /// Implementation of [`Connector`] to support connecting via TCP. pub struct TcpConnector { addr: T, } impl TcpConnector { pub fn new(addr: T) -> Self { Self { addr } } } impl From for TcpConnector { fn from(addr: T) -> Self { Self::new(addr) } } #[async_trait] impl Connector for TcpConnector { type Transport = TcpTransport; async fn connect(self) -> io::Result { TcpTransport::connect(self.addr).await } }