pub struct SocketAddress {
pub ip: IPAddress,
pub port: u16,
}Expand description
Represents an IP address with an associated port.
Fields§
§ip: IPAddress§port: u16Trait Implementations§
Source§impl Clone for SocketAddress
impl Clone for SocketAddress
Source§fn clone(&self) -> SocketAddress
fn clone(&self) -> SocketAddress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SocketAddress
impl Debug for SocketAddress
Source§impl Hash for SocketAddress
impl Hash for SocketAddress
Source§impl Ord for SocketAddress
impl Ord for SocketAddress
Source§fn cmp(&self, other: &SocketAddress) -> Ordering
fn cmp(&self, other: &SocketAddress) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SocketAddress
impl PartialEq for SocketAddress
Source§impl PartialOrd for SocketAddress
impl PartialOrd for SocketAddress
Source§impl ToString for SocketAddress
impl ToString for SocketAddress
Source§fn to_string(&self) -> String
fn to_string(&self) -> String
use inet::socket::SocketAddress;
use inet::ip::{IPAddress, IPv4Address, IPv6Address};
let ip: IPAddress = IPAddress::V4(IPv4Address::LOCALHOST);
let s: SocketAddress = SocketAddress{ ip, port: 80 };
assert_eq!(s.to_string(), "127.0.0.1:80");
let ip: IPAddress = IPAddress::V6(IPv6Address::LOCALHOST);
let s: SocketAddress = SocketAddress{ ip, port: 80 };
assert_eq!(s.to_string(), "[::1]:80");impl Copy for SocketAddress
impl Eq for SocketAddress
impl StructuralPartialEq for SocketAddress
Auto Trait Implementations§
impl Freeze for SocketAddress
impl RefUnwindSafe for SocketAddress
impl Send for SocketAddress
impl Sync for SocketAddress
impl Unpin for SocketAddress
impl UnwindSafe for SocketAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more