embedded_nal_async/stack/
tcp.rs1use core::net::SocketAddr;
2
3pub trait TcpConnect {
8 type Error: embedded_io_async::Error;
10
11 type Connection<'a>: embedded_io_async::Read<Error = Self::Error>
13 + embedded_io_async::Write<Error = Self::Error>
14 where
15 Self: 'a;
16
17 async fn connect<'a>(&'a self, remote: SocketAddr)
21 -> Result<Self::Connection<'a>, Self::Error>;
22}
23
24impl<T: TcpConnect> TcpConnect for &T {
25 type Error = T::Error;
26
27 type Connection<'a>
28 = T::Connection<'a>
29 where
30 Self: 'a;
31
32 async fn connect<'a>(
33 &'a self,
34 remote: SocketAddr,
35 ) -> Result<Self::Connection<'a>, Self::Error> {
36 T::connect(self, remote).await
37 }
38}