Skip to main content

IntoListenAddr

Trait IntoListenAddr 

Source
pub trait IntoListenAddr {
    // Required method
    fn into_listen_addr(self) -> Result<SocketAddr, Error>;
}
Expand description

Conversion into a single TCP bind address.

Implemented for the address-shaped inputs — a bare port (binds 0.0.0.0:port), a SocketAddr or its v4/v6 forms, and (ip, port) tuples — all of which are infallible, and for the string and (host, port) forms, which are resolved through the system resolver and so can fail or yield no address. A resolving form binds the first address it resolves to; pass a SocketAddr when you need to pin exactly which one.

Required Methods§

Source

fn into_listen_addr(self) -> Result<SocketAddr, Error>

Resolve to the concrete socket address to bind, surfacing a resolution failure as an io::Error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoListenAddr for &str

Source§

impl IntoListenAddr for (&str, u16)

Source§

impl IntoListenAddr for (IpAddr, u16)

Source§

impl IntoListenAddr for (Ipv4Addr, u16)

Source§

impl IntoListenAddr for (Ipv6Addr, u16)

Source§

impl IntoListenAddr for SocketAddr

Source§

impl IntoListenAddr for SocketAddrV4

Source§

impl IntoListenAddr for SocketAddrV6

Source§

impl IntoListenAddr for String

Source§

impl IntoListenAddr for u16

Implementors§