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