#[non_exhaustive]pub struct Interface {
pub id: Id<Interface>,
pub index: u32,
pub name: String,
pub kind: InterfaceKind,
pub mac: Option<MacAddress>,
pub mtu: Option<u32>,
pub admin_state: AdminState,
pub operational_state: OperationalState,
}Expand description
A network interface.
#[non_exhaustive]: platforms carry different interface fields (Linux
exposes carrier, txqueuelen, type; Windows exposes MediaType,
OperationalStatus; 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 Interface via
Interface::new rather than a struct literal — see ARCHITECTURE.md’s
note on model extensibility.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: Id<Interface>§index: u32The OS-level interface index (ifindex on Linux, InterfaceIndex on
Windows, if_index on BSD/macOS). This is the same raw value
Route::interface_index carries — kept here as the canonical home
now that the interface domain exists (Stage 0.4).
name: String§kind: InterfaceKind§mac: Option<MacAddress>§mtu: Option<u32>§admin_state: AdminState§operational_state: OperationalStateImplementations§
Source§impl Interface
impl Interface
pub fn new( id: Id<Interface>, index: u32, name: impl Into<String>, kind: InterfaceKind, ) -> Interface
pub fn with_mac(self, mac: MacAddress) -> Interface
pub fn with_mtu(self, mtu: u32) -> Interface
pub fn with_admin_state(self, state: AdminState) -> Interface
pub fn with_operational_state(self, state: OperationalState) -> Interface
Trait Implementations§
impl Eq for Interface
impl StructuralPartialEq for Interface
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnsafeUnpin for Interface
impl UnwindSafe for Interface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more