pub trait TcpConnect {
type Error: Error;
type Connection<'a>: Read<Error = Self::Error> + Write<Error = Self::Error>
where Self: 'a;
// Required method
async fn connect<'a>(
&'a self,
remote: SocketAddr,
) -> Result<Self::Connection<'a>, Self::Error>;
}
Expand description
This trait is implemented by TCP/IP stacks. The trait allows the underlying driver to construct multiple connections that implement the I/O traits from embedded-io-async.
The associated connection type should close the connection when dropped.
Required Associated Types§
Required Methods§
Sourceasync fn connect<'a>(
&'a self,
remote: SocketAddr,
) -> Result<Self::Connection<'a>, Self::Error>
async fn connect<'a>( &'a self, remote: SocketAddr, ) -> Result<Self::Connection<'a>, Self::Error>
Connect to the given remote host and port.
Returns Ok
if the connection was successful.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.