pub trait SocketAddrExt:
Sized
+ ToSocketAddrs
+ Copy
+ Display
+ Debug
+ Send
+ Eq
+ Hash {
// Required methods
fn is_multicast(&self) -> bool;
fn port(&self) -> u16;
fn addr_to_string(&self) -> String;
// Provided methods
fn conforming_to(&self, local: Self) -> Option<Self> { ... }
fn as_uri_buf(&self, scheme: &str) -> UriBuf { ... }
}
Expand description
Extension trait for SocketAddr
types that allows the local endpoint get the information
it needs.
Required Methods§
Sourcefn is_multicast(&self) -> bool
fn is_multicast(&self) -> bool
Determines if the address in this SocketAddr
is a multicast/broadcast address or not.
Sourcefn port(&self) -> u16
fn port(&self) -> u16
Returns the port number for this socket.
A value of zero indicates no specific value.
Sourcefn addr_to_string(&self) -> String
fn addr_to_string(&self) -> String
Renders the address portion to a string.
Provided Methods§
Sourcefn conforming_to(&self, local: Self) -> Option<Self>
fn conforming_to(&self, local: Self) -> Option<Self>
Returns a version of this socket address that conforms to the address type of local
,
or None
if such a conversion is not possible.
This method is useful in mixed ipv6/ipv4 environments.
Sourcefn as_uri_buf(&self, scheme: &str) -> UriBuf
fn as_uri_buf(&self, scheme: &str) -> UriBuf
Creates a URI from this SocketAddr
using the given scheme.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.