From 7d6c0e68a19ad5e2e4e05cfc219d446be6ff2286 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 30 Nov 2023 22:52:53 +0300 Subject: jsonrpc: Enhance the API and add support for TCP, Unix, and TLS protocols. --- net/src/transports/tcp.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'net/src/transports/tcp.rs') diff --git a/net/src/transports/tcp.rs b/net/src/transports/tcp.rs index 37f00a7..37ad860 100644 --- a/net/src/transports/tcp.rs +++ b/net/src/transports/tcp.rs @@ -83,3 +83,15 @@ pub async fn listen_tcp(addr: &Addr, port: &Port) -> Result { let listener = TcpListener::bind(address).await?; Ok(listener) } + +impl From for Box { + fn from(conn: TcpStream) -> Self { + Box::new(TcpConn::new(conn)) + } +} + +impl From for Box { + fn from(listener: TcpListener) -> Self { + Box::new(listener) + } +} -- cgit v1.2.3