Skip to main content

ToSocketAddrs

Trait ToSocketAddrs 

Source
pub trait ToSocketAddrs {
    type Iter: Iterator<Item = Self::SocketAddr>;
    type SocketAddr: SocketAddrExt + Copy;
    type Error: Debug;

    // Required method
    fn to_socket_addrs(&self) -> Result<Self::Iter, Self::Error>;
}
Expand description

A flavor of std::net::ToSocketAddrs that allows the implementation of SocketAddr to be replaced.

This is necessary to enable support for things like CoAP-over-SMS, where socket addresses are telephone numbers.

Required Associated Types§

Source

type Iter: Iterator<Item = Self::SocketAddr>

Source

type SocketAddr: SocketAddrExt + Copy

The SocketAddr type returned by the above iterator.

Source

type Error: Debug

The error type to use for errors while resolving.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl ToSocketAddrs for LoopbackSocketAddr

Source§

impl ToSocketAddrs for NullSocketAddr

Source§

impl<T, I> ToSocketAddrs for T
where T: ToSocketAddrs<Iter = I>, I: Iterator<Item = SocketAddr>,

Available on crate feature std only.

Blanket implementation of ToSocketAddrs for all implementations of std::net::ToSocketAddrs.