pub trait UnicastAddress {
    // Required method
    fn is_unicast(&self) -> bool;
Expand description

Addresses that can be unicast.

UnicastAddress is implemented by address types for which some values are considered unicast addresses. Unicast addresses are used to identify a single network node, as opposed to broadcast and multicast addresses, which identify a group of nodes.

UnicastAddress is only implemented for addresses whose unicast-ness can be determined by looking only at the address itself (this is notably not true for IPv4 addresses, which can be considered broadcast addresses depending on the subnet in which they are used).

Required Methods§


fn is_unicast(&self) -> bool

Is this a unicast address?

is_unicast 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 UnicastAddr. 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.

If this type also implements SpecifiedAddress, then a.is_unicast() implies a.is_specified().