1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Contains the calculated route's details for each path between a pair of positions. The number of legs returned corresponds to one fewer than the total number of positions in the request.</p>
/// <p>For example, a route with a departure position and destination position returns one leg with the positions <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>:</p>
/// <ul>
/// <li>
/// <p>The <code>StartPosition</code> is the departure position.</p></li>
/// <li>
/// <p>The <code>EndPosition</code> is the destination position.</p></li>
/// </ul>
/// <p>A route with a waypoint between the departure and destination position returns two legs with the positions snapped to a nearby road:</p>
/// <ul>
/// <li>
/// <p>Leg 1: The <code>StartPosition</code> is the departure position . The <code>EndPosition</code> is the waypoint positon.</p></li>
/// <li>
/// <p>Leg 2: The <code>StartPosition</code> is the waypoint position. The <code>EndPosition</code> is the destination position.</p></li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Leg {
/// <p>The starting position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>StartPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub start_position: ::std::vec::Vec<f64>,
/// <p>The terminating position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>EndPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/nap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub end_position: ::std::vec::Vec<f64>,
/// <p>The distance between the leg's <code>StartPosition</code> and <code>EndPosition</code> along a calculated route.</p>
/// <ul>
/// <li>
/// <p>The default measurement is <code>Kilometers</code> unless the request specifies a <code>DistanceUnit</code> of <code>Miles</code>.</p></li>
/// </ul>
pub distance: f64,
/// <p>The estimated travel time between the leg's <code>StartPosition</code> and <code>EndPosition</code>. The travel mode and departure time that you specify in the request determines the calculated time.</p>
pub duration_seconds: f64,
/// <p>Contains the calculated route's path as a linestring geometry.</p>
pub geometry: ::std::option::Option<crate::types::LegGeometry>,
/// <p>Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move to the next step in the leg such as the step's start position, end position, travel distance, travel duration, and geometry offset.</p>
pub steps: ::std::vec::Vec<crate::types::Step>,
}
impl Leg {
/// <p>The starting position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>StartPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn start_position(&self) -> &[f64] {
use std::ops::Deref;
self.start_position.deref()
}
/// <p>The terminating position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>EndPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/nap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn end_position(&self) -> &[f64] {
use std::ops::Deref;
self.end_position.deref()
}
/// <p>The distance between the leg's <code>StartPosition</code> and <code>EndPosition</code> along a calculated route.</p>
/// <ul>
/// <li>
/// <p>The default measurement is <code>Kilometers</code> unless the request specifies a <code>DistanceUnit</code> of <code>Miles</code>.</p></li>
/// </ul>
pub fn distance(&self) -> f64 {
self.distance
}
/// <p>The estimated travel time between the leg's <code>StartPosition</code> and <code>EndPosition</code>. The travel mode and departure time that you specify in the request determines the calculated time.</p>
pub fn duration_seconds(&self) -> f64 {
self.duration_seconds
}
/// <p>Contains the calculated route's path as a linestring geometry.</p>
pub fn geometry(&self) -> ::std::option::Option<&crate::types::LegGeometry> {
self.geometry.as_ref()
}
/// <p>Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move to the next step in the leg such as the step's start position, end position, travel distance, travel duration, and geometry offset.</p>
pub fn steps(&self) -> &[crate::types::Step] {
use std::ops::Deref;
self.steps.deref()
}
}
impl ::std::fmt::Debug for Leg {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("Leg");
formatter.field("start_position", &"*** Sensitive Data Redacted ***");
formatter.field("end_position", &"*** Sensitive Data Redacted ***");
formatter.field("distance", &"*** Sensitive Data Redacted ***");
formatter.field("duration_seconds", &"*** Sensitive Data Redacted ***");
formatter.field("geometry", &self.geometry);
formatter.field("steps", &self.steps);
formatter.finish()
}
}
impl Leg {
/// Creates a new builder-style object to manufacture [`Leg`](crate::types::Leg).
pub fn builder() -> crate::types::builders::LegBuilder {
crate::types::builders::LegBuilder::default()
}
}
/// A builder for [`Leg`](crate::types::Leg).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct LegBuilder {
pub(crate) start_position: ::std::option::Option<::std::vec::Vec<f64>>,
pub(crate) end_position: ::std::option::Option<::std::vec::Vec<f64>>,
pub(crate) distance: ::std::option::Option<f64>,
pub(crate) duration_seconds: ::std::option::Option<f64>,
pub(crate) geometry: ::std::option::Option<crate::types::LegGeometry>,
pub(crate) steps: ::std::option::Option<::std::vec::Vec<crate::types::Step>>,
}
impl LegBuilder {
/// Appends an item to `start_position`.
///
/// To override the contents of this collection use [`set_start_position`](Self::set_start_position).
///
/// <p>The starting position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>StartPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn start_position(mut self, input: f64) -> Self {
let mut v = self.start_position.unwrap_or_default();
v.push(input);
self.start_position = ::std::option::Option::Some(v);
self
}
/// <p>The starting position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>StartPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn set_start_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
self.start_position = input;
self
}
/// <p>The starting position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>StartPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/snap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn get_start_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
&self.start_position
}
/// Appends an item to `end_position`.
///
/// To override the contents of this collection use [`set_end_position`](Self::set_end_position).
///
/// <p>The terminating position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>EndPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/nap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn end_position(mut self, input: f64) -> Self {
let mut v = self.end_position.unwrap_or_default();
v.push(input);
self.end_position = ::std::option::Option::Some(v);
self
}
/// <p>The terminating position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>EndPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/nap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn set_end_position(mut self, input: ::std::option::Option<::std::vec::Vec<f64>>) -> Self {
self.end_position = input;
self
}
/// <p>The terminating position of the leg. Follows the format <code>\[longitude,latitude\]</code>.</p><note>
/// <p>If the <code>EndPosition</code> isn't located on a road, it's <a href="https://docs.aws.amazon.com/location/previous/developerguide/nap-to-nearby-road.html">snapped to a nearby road</a>.</p>
/// </note>
pub fn get_end_position(&self) -> &::std::option::Option<::std::vec::Vec<f64>> {
&self.end_position
}
/// <p>The distance between the leg's <code>StartPosition</code> and <code>EndPosition</code> along a calculated route.</p>
/// <ul>
/// <li>
/// <p>The default measurement is <code>Kilometers</code> unless the request specifies a <code>DistanceUnit</code> of <code>Miles</code>.</p></li>
/// </ul>
/// This field is required.
pub fn distance(mut self, input: f64) -> Self {
self.distance = ::std::option::Option::Some(input);
self
}
/// <p>The distance between the leg's <code>StartPosition</code> and <code>EndPosition</code> along a calculated route.</p>
/// <ul>
/// <li>
/// <p>The default measurement is <code>Kilometers</code> unless the request specifies a <code>DistanceUnit</code> of <code>Miles</code>.</p></li>
/// </ul>
pub fn set_distance(mut self, input: ::std::option::Option<f64>) -> Self {
self.distance = input;
self
}
/// <p>The distance between the leg's <code>StartPosition</code> and <code>EndPosition</code> along a calculated route.</p>
/// <ul>
/// <li>
/// <p>The default measurement is <code>Kilometers</code> unless the request specifies a <code>DistanceUnit</code> of <code>Miles</code>.</p></li>
/// </ul>
pub fn get_distance(&self) -> &::std::option::Option<f64> {
&self.distance
}
/// <p>The estimated travel time between the leg's <code>StartPosition</code> and <code>EndPosition</code>. The travel mode and departure time that you specify in the request determines the calculated time.</p>
/// This field is required.
pub fn duration_seconds(mut self, input: f64) -> Self {
self.duration_seconds = ::std::option::Option::Some(input);
self
}
/// <p>The estimated travel time between the leg's <code>StartPosition</code> and <code>EndPosition</code>. The travel mode and departure time that you specify in the request determines the calculated time.</p>
pub fn set_duration_seconds(mut self, input: ::std::option::Option<f64>) -> Self {
self.duration_seconds = input;
self
}
/// <p>The estimated travel time between the leg's <code>StartPosition</code> and <code>EndPosition</code>. The travel mode and departure time that you specify in the request determines the calculated time.</p>
pub fn get_duration_seconds(&self) -> &::std::option::Option<f64> {
&self.duration_seconds
}
/// <p>Contains the calculated route's path as a linestring geometry.</p>
pub fn geometry(mut self, input: crate::types::LegGeometry) -> Self {
self.geometry = ::std::option::Option::Some(input);
self
}
/// <p>Contains the calculated route's path as a linestring geometry.</p>
pub fn set_geometry(mut self, input: ::std::option::Option<crate::types::LegGeometry>) -> Self {
self.geometry = input;
self
}
/// <p>Contains the calculated route's path as a linestring geometry.</p>
pub fn get_geometry(&self) -> &::std::option::Option<crate::types::LegGeometry> {
&self.geometry
}
/// Appends an item to `steps`.
///
/// To override the contents of this collection use [`set_steps`](Self::set_steps).
///
/// <p>Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move to the next step in the leg such as the step's start position, end position, travel distance, travel duration, and geometry offset.</p>
pub fn steps(mut self, input: crate::types::Step) -> Self {
let mut v = self.steps.unwrap_or_default();
v.push(input);
self.steps = ::std::option::Option::Some(v);
self
}
/// <p>Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move to the next step in the leg such as the step's start position, end position, travel distance, travel duration, and geometry offset.</p>
pub fn set_steps(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Step>>) -> Self {
self.steps = input;
self
}
/// <p>Contains a list of steps, which represent subsections of a leg. Each step provides instructions for how to move to the next step in the leg such as the step's start position, end position, travel distance, travel duration, and geometry offset.</p>
pub fn get_steps(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Step>> {
&self.steps
}
/// Consumes the builder and constructs a [`Leg`](crate::types::Leg).
/// This method will fail if any of the following fields are not set:
/// - [`start_position`](crate::types::builders::LegBuilder::start_position)
/// - [`end_position`](crate::types::builders::LegBuilder::end_position)
/// - [`distance`](crate::types::builders::LegBuilder::distance)
/// - [`duration_seconds`](crate::types::builders::LegBuilder::duration_seconds)
/// - [`steps`](crate::types::builders::LegBuilder::steps)
pub fn build(self) -> ::std::result::Result<crate::types::Leg, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Leg {
start_position: self.start_position.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"start_position",
"start_position was not specified but it is required when building Leg",
)
})?,
end_position: self.end_position.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"end_position",
"end_position was not specified but it is required when building Leg",
)
})?,
distance: self.distance.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"distance",
"distance was not specified but it is required when building Leg",
)
})?,
duration_seconds: self.duration_seconds.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"duration_seconds",
"duration_seconds was not specified but it is required when building Leg",
)
})?,
geometry: self.geometry,
steps: self.steps.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"steps",
"steps was not specified but it is required when building Leg",
)
})?,
})
}
}
impl ::std::fmt::Debug for LegBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("LegBuilder");
formatter.field("start_position", &"*** Sensitive Data Redacted ***");
formatter.field("end_position", &"*** Sensitive Data Redacted ***");
formatter.field("distance", &"*** Sensitive Data Redacted ***");
formatter.field("duration_seconds", &"*** Sensitive Data Redacted ***");
formatter.field("geometry", &self.geometry);
formatter.field("steps", &self.steps);
formatter.finish()
}
}