Skip to main content

Address

Trait Address 

Source
pub trait Address: Unpin + 'static {
    // Required methods
    fn host(&self) -> &str;
    fn port(&self) -> Option<u16>;

    // Provided method
    fn addr(&self) -> Option<SocketAddr> { ... }
}
Expand description

Address information required by Connect.

Required Methods§

Source

fn host(&self) -> &str

Returns the host name.

Source

fn port(&self) -> Option<u16>

Returns an explicitly configured port, if available.

Provided Methods§

Source

fn addr(&self) -> Option<SocketAddr>

Returns a pre-resolved socket address, if available.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Address for &'static str

Source§

fn host(&self) -> &str

Source§

fn port(&self) -> Option<u16>

Source§

impl Address for SocketAddr

Source§

fn host(&self) -> &'static str

Source§

fn port(&self) -> Option<u16>

Source§

fn addr(&self) -> Option<SocketAddr>

Source§

impl Address for String

Source§

fn host(&self) -> &str

Source§

fn port(&self) -> Option<u16>

Source§

impl Address for Url

Source§

fn host(&self) -> &str

Source§

fn port(&self) -> Option<u16>

Implementors§