diff options
author | hozan23 <hozan23@proton.me> | 2023-11-30 23:51:18 +0300 |
---|---|---|
committer | hozan23 <hozan23@proton.me> | 2023-11-30 23:51:18 +0300 |
commit | 5111a3d5749625c3d8e26a24a5a32c4da58f18d3 (patch) | |
tree | 0d8376af78d0ec09f3464ba4370ebb8cdd43826d /net/src/connection.rs | |
parent | d8425015363cc0ac4742f938dc3f8e9d0beaa933 (diff) |
net: Use ToConn and ToListener traits for objects that can be converted
to Conn and Listener.
Diffstat (limited to 'net/src/connection.rs')
-rw-r--r-- | net/src/connection.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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<dyn Connection>` pub type Conn = Box<dyn Connection>; +/// 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`]. /// |