[go: up one dir, main page]

Trait SocketAddrExt

Source
pub trait SocketAddrExt {
    // Required methods
    fn new(ip: IpAddr, port: u16) -> SocketAddr;
    fn ip(&self) -> IpAddr;
}
Expand description

Methods to convert between IpAddr and std::net::SocketAddr

Required Methods§

Source

fn new(ip: IpAddr, port: u16) -> SocketAddr

Creates a new socket address from the (ip, port) pair.

Source

fn ip(&self) -> IpAddr

Returns the IP address associated with this socket address.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SocketAddrExt for SocketAddr

Source§

fn new(ip: IpAddr, port: u16) -> SocketAddr

Source§

fn ip(&self) -> IpAddr

Implementors§