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
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Route
impl UnwindSafe for Route
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V