#[non_exhaustive]pub struct Route {
pub hops: Hops,
pub cost: Cost,
/* private fields */
}Expand description
The path a route took through the mesh and what using it costs.
The metadata half of an advertisement: Producer::dynamic pairs it with
the prefix it covers, broadcast::Producer::announce with the
broadcast’s exact path, and Consumer::announced yields both. A route
claims capability, not inventory: it says paths under its prefix are
servable, never that any specific broadcast exists. The common convention is
that a publisher announces each broadcast’s exact path, so subscribers can
enumerate broadcasts; a service instead announces one short prefix and
answers whatever is requested beneath it.
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.hops: HopsThe chain of origins the route has traversed, oldest first. Each relay
appends its own crate::Hop when forwarding; used for loop detection
and as the selection tie-break. A 0 entry is the anonymous mark and
travels unchanged; see Self::is_anonymous.
cost: CostWhat pulling content via this route costs, accumulated per link: lower wins
among routes of the same anonymity, with ties broken by hop length, then a
deterministic hash, and finally the most recently announced route. See Cost.
Implementations§
Source§impl Route
impl Route
Sourcepub fn with_cost(self, cost: impl Into<Cost>) -> Self
pub fn with_cost(self, cost: impl Into<Cost>) -> Self
Set the cost: lower wins among routes covering the same prefix and anonymity.
A bare u64 prices the route undiscounted (both halves of Cost alike),
which is what a publisher seeding its production cost means.
Sourcepub fn is_anonymous(&self) -> bool
pub fn is_anonymous(&self) -> bool
Whether this route passed through an anonymous hop.
True when the chain holds a 0 anywhere, including Lite03 hop-count placeholders. An anonymous route ranks below every fully identified one, whatever the costs say. An empty chain is a local announcement, not the anonymous mark; ingress fills a received empty list with 0 before it enters the table.