diff options
-rw-r--r-- | lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -235,6 +235,19 @@ pub enum Listener { Unix(unix::UnixListener) } +impl From<net::TcpListener> for Listener { + fn from(s: net::TcpListener) -> Listener { + Listener::Inet(s) + } +} + +#[cfg(unix)] +impl From<unix::UnixListener> for Listener { + fn from(s: unix::UnixListener) -> Listener { + Listener::Unix(s) + } +} + impl Listener { pub fn bind(s: &SocketAddr) -> io::Result<Listener> { match s { |