Skip to main content

AddressInfoView

Trait AddressInfoView 

Source
pub trait AddressInfoView {
    // Required methods
    fn address(&self) -> SocketAddress;
    fn socket_type(&self) -> SocketType;
    fn protocol(&self) -> Option<SocketProtocol>;

    // Provided method
    fn to_address_info(&self) -> AddressInfo { ... }
}
Expand description

Portable accessors for a resolved IP endpoint and its socket creation parameters. A view may borrow a native resolver entry; accessing one field need not copy or normalize the others.

Required Methods§

Source

fn address(&self) -> SocketAddress

Decode the IP endpoint on demand, preserving IPv6 flow information and scope identifiers.

Source

fn socket_type(&self) -> SocketType

Source

fn protocol(&self) -> Option<SocketProtocol>

None represents the resolver’s zero/default protocol.

Provided Methods§

Source

fn to_address_info(&self) -> AddressInfo

Explicitly materialize a small, owned portable record. This conversion requires no heap allocation.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: AddressInfoView + ?Sized> AddressInfoView for &T

Implementors§