Skip to main content

Route

Struct Route 

Source
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 EDHL

would 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 EDHL

we 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

Source

pub fn new() -> Self

Source

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.

Source

pub fn tokens(&self) -> &[Token]

Returns the tokens used to build the route.

Source

pub fn clear(&mut self)

Clears the route elements, legs and alternate.

Source

pub fn legs(&self) -> &[Leg]

Returns the legs of the route.

Source

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.

Source

pub fn speed(&self) -> Option<Speed>

Source

pub fn level(&self) -> Option<VerticalDistance>

Source

pub fn set_alternate(&mut self, alternate: Option<NavAid>)

Sets an alternate on the route.

The alternate is remove by setting it to None.

Source

pub fn alternate(&self) -> Option<Leg>

Returns the final leg but going to the alternate.

Source

pub fn origin(&self) -> Option<Rc<Airport>>

Returns the origin airport if one is defined in the route.

Source

pub fn takeoff_rwy(&self) -> Option<&Runway>

Returns the takeoff runway if a defined in the route.

Source

pub fn destination(&self) -> Option<Rc<Airport>>

Returns the destination airport if one is defined in the route.

Source

pub fn landing_rwy(&self) -> Option<&Runway>

Returns the landing runway if a defined in the route.

Source

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.

Source

pub fn totals(&self, perf: Option<&Performance>) -> Option<TotalsToLeg>

Returns the totals of the entire route.

Source

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());
}
Source§

impl Route

Source

pub fn to_geojson(&self) -> GeoJson

Available on crate feature geojson only.

Returns the route’s legs as GeoJSON with a line string geometry.

Trait Implementations§

Source§

impl Clone for Route

Source§

fn clone(&self) -> Route

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Route

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Route

Source§

fn default() -> Route

Returns the “default value” for a type. Read more
Source§

impl Display for Route

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Route

Source§

fn eq(&self, other: &Route) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool