#[non_exhaustive]pub struct InterfaceAddress {
pub id: Id<InterfaceAddress>,
pub interface_index: u32,
pub address: Network,
pub broadcast: Option<IpAddress>,
}Expand description
An IP address assigned to a network interface, plus the prefix length it
was assigned with (e.g. 192.168.1.10/24).
Named ifaddr, not address, to avoid colliding with the address
module’s IpAddress/Network primitives — this is a distinct domain
concept (an address bound to an interface), not another address
representation.
#[non_exhaustive]: platforms carry different address fields (Linux
exposes address scope and lifetime/deprecation timers via
IFA_CACHEINFO; Windows exposes per-address DadState/SkipAsSource;
BSD/macOS expose a combined flags word). Marking this non-exhaustive now
means adding platform-specific fields later is not a breaking change for
consumers who construct an InterfaceAddress via
InterfaceAddress::new rather than a struct literal — see
ARCHITECTURE.md’s note on model extensibility.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: Id<InterfaceAddress>§interface_index: u32The OS-level interface index this address is assigned to, the same
raw value Interface::index/Route::interface_index carry.
address: NetworkThe assigned address and the prefix length it carries.
broadcast: Option<IpAddress>The IPv4 broadcast address for this subnet, if the platform reports
one. Always None for IPv6, which has no broadcast concept.
Implementations§
Source§impl InterfaceAddress
impl InterfaceAddress
pub fn new( id: Id<InterfaceAddress>, interface_index: u32, address: Network, ) -> InterfaceAddress
pub fn with_broadcast(self, broadcast: IpAddress) -> InterfaceAddress
Trait Implementations§
Source§impl Clone for InterfaceAddress
impl Clone for InterfaceAddress
Source§fn clone(&self) -> InterfaceAddress
fn clone(&self) -> InterfaceAddress
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more