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

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>,
}
Expand description

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.

Implementations

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();

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();

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();

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();

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();

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.