From 5111a3d5749625c3d8e26a24a5a32c4da58f18d3 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 30 Nov 2023 23:51:18 +0300 Subject: net: Use ToConn and ToListener traits for objects that can be converted to Conn and Listener. --- net/src/connection.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'net/src/connection.rs') diff --git a/net/src/connection.rs b/net/src/connection.rs index b1d7550..3c047a0 100644 --- a/net/src/connection.rs +++ b/net/src/connection.rs @@ -8,6 +8,11 @@ use crate::{ /// Alias for `Box` pub type Conn = Box; +/// A trait for objects which can be converted to [`Conn`]. +pub trait ToConn { + fn to_conn(self) -> Conn; +} + /// Connection is a generic network connection interface for /// [`udp::UdpConn`], [`tcp::TcpConn`], and [`unix::UnixConn`]. /// -- cgit v1.2.3