Trait net_types::SpecifiedAddress

source ·
pub trait SpecifiedAddress {
    // Required method
    fn is_specified(&self) -> bool;
}
Expand description

Addresses that can be specified.

SpecifiedAddress is implemented by address types for which some values are considered unspecified addresses. Unspecified addresses are usually not legal to be used in actual network traffic, and are only meant to represent the lack of any defined address. The exact meaning of the unspecified address often varies by context. For example, the IPv4 address 0.0.0.0 and the IPv6 address :: can be used, in the context of creating a listening socket on systems that use the BSD sockets API, to listen on all local IP addresses rather than a particular one.

Required Methods§

source

fn is_specified(&self) -> bool

Is this a specified address?

is_specified must maintain the invariant that, if it is called twice on the same object, and in between those two calls, no code has operated on a mutable reference to that object, both calls will return the same value. This property is required in order to implement SpecifiedAddr. Note that, since this is not an unsafe trait, unsafe code may NOT rely on this property for its soundness. However, code MAY rely on this property for its correctness.

Implementors§