diff options
author | Yorhel <git@yorhel.nl> | 2019-05-21 15:43:52 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-05-21 15:43:55 +0200 |
commit | 58f99898d2f0c3957f2f348f7c5da0c48702b4d1 (patch) | |
tree | c33b9ab6a4f27b9a9cb710fc6570fd4d6892dafd | |
parent | efbc366c27ec5fa9b9fe57712e184a1aa0158775 (diff) |
Add From<..> impls for Listener
Not sure how I had forgotten these.
-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 { |