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> = T::Connection<'a> where Self: 'a;
28
29 async fn connect<'a>(
30 &'a self,
31 remote: SocketAddr,
32 ) -> Result<Self::Connection<'a>, Self::Error> {
33 T::connect(self, remote).await
34 }
35}