[][src]Struct google_maps::directions::response::route::Route

pub struct Route {
    pub bounds: Bounds,
    pub copyrights: String,
    pub fare: Option<TransitFare>,
    pub legs: Vec<Leg>,
    pub overview_polyline: OverviewPolyline,
    pub summary: String,
    pub warnings: Vec<String>,
    pub waypoint_order: Vec<u8>,
}

A single route containing a set of legs in a Response. Note that though this object is "JSON-like," it is not strictly JSON, as it directly and indirectly includes LatLng objects.

Fields

bounds: Bounds

The bounds for this route.

copyrights: String

Copyrights text to be displayed for this route.

fare: Option<TransitFare>

If present, contains the total fare (that is, the total ticket costs) on this route. This property is only returned for transit requests and only for routes where fare information is available for all transit legs.

legs: Vec<Leg>

An array of Legs, each of which contains information about the steps of which it is composed. There will be one leg for each stopover waypoint or destination specified. So a route with no stopover waypoints will contain one Leg and a route with one stopover waypoint will contain two.

overview_polyline: OverviewPolyline

An encoded polyline representation of the route. This polyline is an approximate (smoothed) path of the resulting directions.

summary: String

Contains a short textual description for the route, suitable for naming and disambiguating the route from alternatives.

warnings: Vec<String>

Contains an array of warnings to be displayed when showing these directions. You must handle and display these warnings yourself.

waypoint_order: Vec<u8>

If optimizeWaypoints was set to true, this field will contain the re-ordered permutation of the input waypoints. For example, if the input was:

    Origin: Los Angeles
    Waypoints: Dallas, Bangor, Phoenix
    Destination: New York

and the optimized output was ordered as follows:

    Origin: Los Angeles
    Waypoints: Phoenix, Dallas, Bangor
    Destination: New York

then this field will be an Array containing the values [2, 0, 1]. Note that the numbering of waypoints is zero-based.

If any of the input waypoints has stopover set to false, this field will be empty, since route optimization is not available for such queries.

Methods

impl Route[src]

pub fn get_summary(&self) -> Option<&String>[src]

A helper function for destructuring (or serializing) the summary field. If the summary text is populated, this function will return the summary text in the String format. If the summary text is empty, this function will return None.

let summary = route.get_summary();

pub fn get_fare_currency(&self) -> Option<String>[src]

A helper function for destructuring (or serializing) the optional fare field. If the fare struct is populated, this function will return the currency code in the String format. If the fare struct is empty, this function will return None.

let fare_currency = route.get_fare_currency();

pub fn get_fare_value(&self) -> Option<Decimal>[src]

A helper function for destructuring (or serializing) the optional fare field. If the fare struct is populated, this function will return the value f64. If the fare struct is empty, this function will return None.

let fare_value = route.get_fare_value();

pub fn get_fare_text(&self) -> Option<&String>[src]

A helper function for destructuring (or serializing) the optional fare field. If the fare struct is populated, this function will return the text String. If the fare struct is empty, this function will return None.

let fare_text = route.get_fare_text();

pub fn get_warnings(&self) -> Option<String>[src]

A helper function for destructuring (or serializing) the warnings field. If the warnings Vec is populated, this function will return the warnings as a String in pipe-separated format. If the warnings Vec is empty, this function will return None.

let warnings = route.get_warning();

pub fn get_waypoint_order(&self) -> Option<String>[src]

A helper function for destructuring (or serializing) the waypoint_order field. If the waypoint_order Vec is populated, this function will return the waypoint order as a String in CSV format. If the waypoint_order Vec is empty, this function will return None.

let waypoint_order = route.get_fare_text();

Trait Implementations

impl Clone for Route[src]

impl Debug for Route[src]

impl<'de> Deserialize<'de> for Route[src]

impl Eq for Route[src]

impl Hash for Route[src]

impl PartialEq<Route> for Route[src]

impl StructuralEq for Route[src]

impl StructuralPartialEq for Route[src]

Auto Trait Implementations

impl RefUnwindSafe for Route

impl Send for Route

impl Sync for Route

impl Unpin for Route

impl UnwindSafe for Route

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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