Skip to main content

find_route

Function find_route 

Source
pub fn find_route(
    chart: &ChartStore,
    from: Position,
    to: Position,
    options: FindOptions,
) -> Result<Option<Vec<Waypoint>>, FindError>
Expand description

The shortest route between from and to that check_leg calls safe for the vessel described in options.

Ok(None) when no route was found even after margin_schedule’s escalation (or, with an explicit margin_nm, after that one attempt). This means either the route is genuinely blocked (an island fills the whole search area) or the lattice is too coarse to find a way through (see smooth::straighten’s own doc). A caller that supplied margin_nm can retry with a larger value; auto-escalation has already been tried when margin_nm was None.

The returned waypoints carry no identity: turning them into a [routes::Route] needs a fresh id, and this layer has no source of randomness, the same reason nav-math has no clock.

§Errors

If the chart cannot be read.