pub trait SocketTap<LOC>:
SocketTapCommon
+ Send
+ Sync
+ Debug {
// Required methods
fn connect<'life0, 'async_trait>(
&'life0 mut self,
conn_timeout: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_encrypted(&self) -> bool;
fn is_tcp(&self) -> bool;
fn should_append_len(&self) -> bool;
fn poll_read<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sndbuf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
rcvbuf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
A common interface to access the realizations for both [TcpStream] and [UdpSocket]
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 mut self,
conn_timeout: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
conn_timeout: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connects to the remote host.
Sourcefn is_encrypted(&self) -> bool
fn is_encrypted(&self) -> bool
Tells if current instace is encrypted
i.e [TcpTlsConnection] over [TcpStream].
Sourcefn is_tcp(&self) -> bool
fn is_tcp(&self) -> bool
Tells if current instance is [TcpStream] if true, or [UdpSocket] if false
fn should_append_len(&self) -> bool
fn poll_read<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sndbuf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
sndbuf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends data over wire.
Sourcefn recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
rcvbuf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 mut self,
rcvbuf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Receives data transmitted from remote host. In nonblocking mode it should be called only after the event was polled In blocking mode it will block until received or timeout.