Struct google_maps::directions::response::step::Step[][src]

pub struct Step {
    pub distance: DirectionsDistance,
    pub duration: DirectionsDuration,
    pub end_location: LatLng,
    pub html_instructions: String,
    pub maneuver: Option<DrivingManeuver>,
    pub polyline: Polyline,
    pub start_location: LatLng,
    pub steps: Option<Vec<Step>>,
    pub transit_details: Option<TransitDetails>,
    pub travel_mode: TravelMode,
}
Expand description

Each element in the steps array defines a single step of the calculated directions. A step is the most atomic unit of a direction’s route, containing a single step describing a specific, single instruction on the journey. E.g. “Turn left at W. 4th St.” The step not only describes the instruction but also contains distance and duration information relating to how this step relates to the following step. For example, a step denoted as “Merge onto I-80 West” may contain a duration of “37 miles” and “40 minutes,” indicating that the next step is 37 miles/40 minutes from this step.

When using the Directions API to search for transit directions, the steps array will include additional transit details in the form of a transit_details array. If the directions include multiple modes of transportation, detailed directions will be provided for walking or driving steps in an inner steps array. For example, a walking step will include directions from the start and end locations: “Walk to Innes Ave & Fitch St”. That step will include detailed walking directions for that route in the inner steps array, such as: “Head north-west”, “Turn left onto Arelious Walker”, and “Turn left onto Innes Ave”.

Fields

distance: DirectionsDistance

The distance covered by this step. This property may be undefined as the distance may be unknown.

duration: DirectionsDuration

The typical time required to perform this step in seconds and in text form. This property may be undefined as the duration may be unknown.

end_location: LatLng

The ending location of this step.

html_instructions: String

Instructions for this step.

maneuver: Option<DrivingManeuver>

Contains the action to take for the current step (turn left, merge, straight, etc.). This field is used to determine which icon to display.

polyline: Polyline

Contains a single points object that holds an encoded polyline representation of the step. This polyline is an approximate (smoothed) path of the step. (Corresponds to path in the Directions.Step interface.)

start_location: LatLng

The starting location of this step.

steps: Option<Vec<Step>>

Contains detailed directions for walking or driving steps in transit directions. Substeps are only available when travel_mode is set to “transit”. The inner steps array is of the same type as steps.

transit_details: Option<TransitDetails>

Transit-specific details about this step. This property will be undefined unless the travel mode of this step is TravelMode::Transit.

travel_mode: TravelMode

The mode of travel used in this step.

Implementations

A helper function for destructuring (or serializing) the optional maneuver field. If the ManeuverType enum in the step is populated, this function will return it as a String. If the ManeuverType enum is empty, this function will return None.

let maneuver = step.get_maneuver();

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.