#[non_exhaustive]pub struct Route {
pub id: Id<Route>,
pub destination: Network,
pub gateway: Option<IpAddress>,
pub metric: Option<u32>,
pub interface_index: Option<u32>,
}Expand description
A single routing table entry.
#[non_exhaustive]: platforms carry different route fields (Linux adds
table/protocol/scope/type on top of destination/gateway/metric; Windows
and BSD expose a narrower set — see ARCHITECTURE.md’s note on model
extensibility). Marking this non-exhaustive now means adding
platform-specific fields later is not a breaking change for consumers
who construct a Route via Route::new rather than a struct literal.
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<Route>§destination: Network§gateway: Option<IpAddress>§metric: Option<u32>§interface_index: Option<u32>The outgoing interface, identified by its raw OS-level index.
This is a raw u32 rather than a typed InterfaceId because the
interface domain module doesn’t exist yet (it lands in Stage 0.4
per ARCHITECTURE.md’s Incremental Delivery Plan) — Route shouldn’t
block on it just to express what the kernel already gives us
directly. Many routes are ambiguous or outright rejected by the
kernel without an explicit output interface (on-link routes,
multiple interfaces on the same subnet), so this isn’t optional
polish: without it, a meaningful fraction of real routes can’t be
added at all.