1 // Take a look at the license at the top of the repository in the LICENSE file. 2 3 use crate::prelude::*; 4 use crate::InetAddress; 5 use crate::InetSocketAddress; 6 7 use std::net::SocketAddr; 8 9 impl From<SocketAddr> for InetSocketAddress { from(addr: SocketAddr) -> Self10 fn from(addr: SocketAddr) -> Self { 11 Self::new::<InetAddress>(&addr.ip().into(), addr.port()) 12 } 13 } 14 15 impl From<InetSocketAddress> for SocketAddr { from(addr: InetSocketAddress) -> Self16 fn from(addr: InetSocketAddress) -> Self { 17 Self::new(addr.address().into(), addr.port()) 18 } 19 } 20