net_types

Trait LinkLocalAddress

Source
pub trait LinkLocalAddress {
    // Required method
    fn is_link_local(&self) -> bool;
}
Expand description

Addresses that can be a link-local.

LinkLocalAddress is implemented by address types for which some values are considered link-local addresses. Link-local addresses are used for communication within a network segment, as opposed to global/public addresses which may be used for communication across networks.

LinkLocalAddress is only implemented for addresses whose link-local-ness can be determined by looking only at the address itself.

Required Methods§

Is this a link-local address?

is_link_local 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 LinkLocalAddr. 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_link_local() implies a.is_specified().

Implementors§