pub struct Route { /* private fields */ }Expand description
A route that goes from an origin to a destination.
The route is composed of legs where each leg describes path between two
fixes.
§Decoding
The route can be decoded from a space separated list of fixes, wind values and performance elements. The route elements
13509KT N0107 EDDH D DCT W EDHLwould create a route from Hamburg to Luebeck via outbound delta routing and inbound whisky routing with a desired TAS of 107kt and a wind of 9kt from south-east. Performance elements can be add at any point but latest before the first leg is defined (we have from and to fix).
Thus, each leg is computed based on the latest performance elements defined on the route. Extending our route to
13509KT N0107 EDDH D DCT 18009KT DCT W EDHLwe would have wind from south-east (135°) on the leg from EDDH to D (VRP Delta), but the wind would turn to south (180°) for the remaining legs.
Implementations§
Source§impl Route
impl Route
pub fn new() -> Self
Sourcepub fn decode(&mut self, route: &str, nd: &NavigationData) -> Result<(), Error>
pub fn decode(&mut self, route: &str, nd: &NavigationData) -> Result<(), Error>
Decodes a route that is composed of a space separated list of fix
idents read from the navigation data nd.
Sourcepub fn set_cruise(
&mut self,
_speed: Option<Speed>,
_level: Option<VerticalDistance>,
)
pub fn set_cruise( &mut self, _speed: Option<Speed>, _level: Option<VerticalDistance>, )
Sets the cruise speed and level.
The cruise speed or level is remove from the route by setting it to
None.
pub fn speed(&self) -> Option<Speed>
pub fn level(&self) -> Option<VerticalDistance>
Sourcepub fn set_alternate(&mut self, alternate: Option<NavAid>)
pub fn set_alternate(&mut self, alternate: Option<NavAid>)
Sets an alternate on the route.
The alternate is remove by setting it to None.
Sourcepub fn origin(&self) -> Option<Rc<Airport>>
pub fn origin(&self) -> Option<Rc<Airport>>
Returns the origin airport if one is defined in the route.
Sourcepub fn takeoff_rwy(&self) -> Option<&Runway>
pub fn takeoff_rwy(&self) -> Option<&Runway>
Returns the takeoff runway if a defined in the route.
Sourcepub fn destination(&self) -> Option<Rc<Airport>>
pub fn destination(&self) -> Option<Rc<Airport>>
Returns the destination airport if one is defined in the route.
Sourcepub fn landing_rwy(&self) -> Option<&Runway>
pub fn landing_rwy(&self) -> Option<&Runway>
Returns the landing runway if a defined in the route.
Sourcepub fn accumulate_legs<'a>(
&'a self,
perf: Option<&'a Performance>,
) -> impl Iterator<Item = TotalsToLeg> + 'a
pub fn accumulate_legs<'a>( &'a self, perf: Option<&'a Performance>, ) -> impl Iterator<Item = TotalsToLeg> + 'a
Returns an iterator that accumulates totals progressively through each leg of the route.
This function provides cumulative totals from the route start up to
each leg. Each yielded TotalsToLeg represents the accumulated totals
from the beginning of the route to that specific leg. If Some
performance is provided, the fuel will be accumulated too.
§Examples
// Iterate through route showing progressive totals
for (i, totals) in route.accumulate_legs(Some(&perf)).enumerate() {
println!("Leg {}: Total distance: {}, Total fuel: {:?}",
i + 1, totals.dist(), totals.fuel());
}§Note
If any leg in the sequence is missing ETE or fuel data, the cumulative ETE/fuel
will be None for that leg and all subsequent legs, following an “all-or-nothing”
approach to ensure data consistency.
Sourcepub fn totals(&self, perf: Option<&Performance>) -> Option<TotalsToLeg>
pub fn totals(&self, perf: Option<&Performance>) -> Option<TotalsToLeg>
Returns the totals of the entire route.
Sourcepub fn vertical_profile(&self, nd: &NavigationData) -> VerticalProfile
pub fn vertical_profile(&self, nd: &NavigationData) -> VerticalProfile
Returns the vertical profile showing all airspace intersections along this route.
The profile contains entry and exit points for each airspace the route passes through, sorted by distance from the route start.
§Examples
let profile = route.vertical_profile(nd);
for intersection in profile.intersections() {
println!("{}: {:.1} NM to {:.1} NM",
intersection.airspace().name,
intersection.entry_distance().value(),
intersection.exit_distance().value());
}Trait Implementations§
impl StructuralPartialEq for Route
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl !Send for Route
impl !Sync for Route
impl Unpin for Route
impl UnsafeUnpin for Route
impl UnwindSafe for Route
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more