Trait ToSocketAddrs
pub trait ToSocketAddrs: ToSocketAddrsPriv { }
Converts or resolves without blocking to one or more SocketAddr values.
DNS
Implementations of ToSocketAddrs for string types require a DNS lookup.
Calling
Currently, this trait is only used as an argument to Tokio functions that need to reference a target socket address. To perform a SocketAddr conversion directly, use lookup_host().
This trait is sealed and is intended to be opaque. The details of the trait will change. Stabilization is pending enhancements to the Rust language.
Dyn Compatibility
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types
impl ToSocketAddrs for &[SocketAddr]
impl ToSocketAddrs for (&str, u16)
Available on crate feature
net only.impl ToSocketAddrs for (IpAddr, u16)
impl ToSocketAddrs for (Ipv4Addr, u16)
impl ToSocketAddrs for (Ipv6Addr, u16)
impl ToSocketAddrs for (String, u16)
Available on crate feature
net only.impl ToSocketAddrs for SocketAddr
impl ToSocketAddrs for SocketAddrV4
impl ToSocketAddrs for SocketAddrV6
impl ToSocketAddrs for String
Available on crate feature
net only.impl ToSocketAddrs for str
Available on crate feature
net only.impl<T: ToSocketAddrs + ?Sized> ToSocketAddrs for &T
Implementors
MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/net/trait.ToSocketAddrs.html