google_maps_geocode_v4/model.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_type;
27extern crate google_geo_type;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Request message for DestinationService.SearchDestinations.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct SearchDestinationsRequest {
43 /// Optional. The travel modes to filter navigation points for. This influences
44 /// the `navigation_points` field returned in the response. If empty,
45 /// navigation points of all travel modes are returned.
46 pub travel_modes: std::vec::Vec<crate::model::navigation_point::TravelMode>,
47
48 /// Optional. Language in which the results should be returned.
49 pub language_code: std::string::String,
50
51 /// Optional. Region code. The region code, specified as a ccTLD ("top-level
52 /// domain") two-character value. The parameter affects results based on
53 /// applicable law. This parameter also influences, but not fully restricts,
54 /// results from the service.
55 pub region_code: std::string::String,
56
57 /// Query for the primary destination. This can be either a place, a fully
58 /// specified address, or a LatLng location. Some places and addresses with
59 /// minimal information won't be able to be turned into a destination.
60 ///
61 /// The destinations are built around the specified primary query.
62 ///
63 /// Note: only places and addresses that can have a navigational destination
64 /// are supported. For example, a place that represents a house or an apartment
65 /// complex can be used as the primary query, but places that represent a
66 /// locality or an administrative area cannot be used as the primary query.
67 pub primary_query: std::option::Option<crate::model::search_destinations_request::PrimaryQuery>,
68
69 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
70}
71
72impl SearchDestinationsRequest {
73 /// Creates a new default instance.
74 pub fn new() -> Self {
75 std::default::Default::default()
76 }
77
78 /// Sets the value of [travel_modes][crate::model::SearchDestinationsRequest::travel_modes].
79 ///
80 /// # Example
81 /// ```ignore,no_run
82 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
83 /// use google_maps_geocode_v4::model::navigation_point::TravelMode;
84 /// let x = SearchDestinationsRequest::new().set_travel_modes([
85 /// TravelMode::Drive,
86 /// TravelMode::Walk,
87 /// ]);
88 /// ```
89 pub fn set_travel_modes<T, V>(mut self, v: T) -> Self
90 where
91 T: std::iter::IntoIterator<Item = V>,
92 V: std::convert::Into<crate::model::navigation_point::TravelMode>,
93 {
94 use std::iter::Iterator;
95 self.travel_modes = v.into_iter().map(|i| i.into()).collect();
96 self
97 }
98
99 /// Sets the value of [language_code][crate::model::SearchDestinationsRequest::language_code].
100 ///
101 /// # Example
102 /// ```ignore,no_run
103 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
104 /// let x = SearchDestinationsRequest::new().set_language_code("example");
105 /// ```
106 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
107 self.language_code = v.into();
108 self
109 }
110
111 /// Sets the value of [region_code][crate::model::SearchDestinationsRequest::region_code].
112 ///
113 /// # Example
114 /// ```ignore,no_run
115 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
116 /// let x = SearchDestinationsRequest::new().set_region_code("example");
117 /// ```
118 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
119 self.region_code = v.into();
120 self
121 }
122
123 /// Sets the value of [primary_query][crate::model::SearchDestinationsRequest::primary_query].
124 ///
125 /// Note that all the setters affecting `primary_query` are mutually
126 /// exclusive.
127 ///
128 /// # Example
129 /// ```ignore,no_run
130 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
131 /// use google_maps_geocode_v4::model::search_destinations_request::PrimaryQuery;
132 /// let x = SearchDestinationsRequest::new().set_primary_query(Some(PrimaryQuery::Place("example".to_string())));
133 /// ```
134 pub fn set_primary_query<
135 T: std::convert::Into<
136 std::option::Option<crate::model::search_destinations_request::PrimaryQuery>,
137 >,
138 >(
139 mut self,
140 v: T,
141 ) -> Self {
142 self.primary_query = v.into();
143 self
144 }
145
146 /// The value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
147 /// if it holds a `Place`, `None` if the field is not set or
148 /// holds a different branch.
149 pub fn place(&self) -> std::option::Option<&std::string::String> {
150 #[allow(unreachable_patterns)]
151 self.primary_query.as_ref().and_then(|v| match v {
152 crate::model::search_destinations_request::PrimaryQuery::Place(v) => {
153 std::option::Option::Some(v)
154 }
155 _ => std::option::Option::None,
156 })
157 }
158
159 /// Sets the value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
160 /// to hold a `Place`.
161 ///
162 /// Note that all the setters affecting `primary_query` are
163 /// mutually exclusive.
164 ///
165 /// # Example
166 /// ```ignore,no_run
167 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
168 /// let x = SearchDestinationsRequest::new().set_place("example");
169 /// assert!(x.place().is_some());
170 /// assert!(x.address_query().is_none());
171 /// assert!(x.location_query().is_none());
172 /// ```
173 pub fn set_place<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
174 self.primary_query = std::option::Option::Some(
175 crate::model::search_destinations_request::PrimaryQuery::Place(v.into()),
176 );
177 self
178 }
179
180 /// The value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
181 /// if it holds a `AddressQuery`, `None` if the field is not set or
182 /// holds a different branch.
183 pub fn address_query(
184 &self,
185 ) -> std::option::Option<
186 &std::boxed::Box<crate::model::search_destinations_request::AddressQuery>,
187 > {
188 #[allow(unreachable_patterns)]
189 self.primary_query.as_ref().and_then(|v| match v {
190 crate::model::search_destinations_request::PrimaryQuery::AddressQuery(v) => {
191 std::option::Option::Some(v)
192 }
193 _ => std::option::Option::None,
194 })
195 }
196
197 /// Sets the value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
198 /// to hold a `AddressQuery`.
199 ///
200 /// Note that all the setters affecting `primary_query` are
201 /// mutually exclusive.
202 ///
203 /// # Example
204 /// ```ignore,no_run
205 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
206 /// use google_maps_geocode_v4::model::search_destinations_request::AddressQuery;
207 /// let x = SearchDestinationsRequest::new().set_address_query(AddressQuery::default()/* use setters */);
208 /// assert!(x.address_query().is_some());
209 /// assert!(x.place().is_none());
210 /// assert!(x.location_query().is_none());
211 /// ```
212 pub fn set_address_query<
213 T: std::convert::Into<
214 std::boxed::Box<crate::model::search_destinations_request::AddressQuery>,
215 >,
216 >(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.primary_query = std::option::Option::Some(
221 crate::model::search_destinations_request::PrimaryQuery::AddressQuery(v.into()),
222 );
223 self
224 }
225
226 /// The value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
227 /// if it holds a `LocationQuery`, `None` if the field is not set or
228 /// holds a different branch.
229 pub fn location_query(
230 &self,
231 ) -> std::option::Option<
232 &std::boxed::Box<crate::model::search_destinations_request::LocationQuery>,
233 > {
234 #[allow(unreachable_patterns)]
235 self.primary_query.as_ref().and_then(|v| match v {
236 crate::model::search_destinations_request::PrimaryQuery::LocationQuery(v) => {
237 std::option::Option::Some(v)
238 }
239 _ => std::option::Option::None,
240 })
241 }
242
243 /// Sets the value of [primary_query][crate::model::SearchDestinationsRequest::primary_query]
244 /// to hold a `LocationQuery`.
245 ///
246 /// Note that all the setters affecting `primary_query` are
247 /// mutually exclusive.
248 ///
249 /// # Example
250 /// ```ignore,no_run
251 /// # use google_maps_geocode_v4::model::SearchDestinationsRequest;
252 /// use google_maps_geocode_v4::model::search_destinations_request::LocationQuery;
253 /// let x = SearchDestinationsRequest::new().set_location_query(LocationQuery::default()/* use setters */);
254 /// assert!(x.location_query().is_some());
255 /// assert!(x.place().is_none());
256 /// assert!(x.address_query().is_none());
257 /// ```
258 pub fn set_location_query<
259 T: std::convert::Into<
260 std::boxed::Box<crate::model::search_destinations_request::LocationQuery>,
261 >,
262 >(
263 mut self,
264 v: T,
265 ) -> Self {
266 self.primary_query = std::option::Option::Some(
267 crate::model::search_destinations_request::PrimaryQuery::LocationQuery(v.into()),
268 );
269 self
270 }
271}
272
273impl wkt::message::Message for SearchDestinationsRequest {
274 fn typename() -> &'static str {
275 "type.googleapis.com/google.maps.geocode.v4.SearchDestinationsRequest"
276 }
277}
278
279/// Defines additional types related to [SearchDestinationsRequest].
280pub mod search_destinations_request {
281 #[allow(unused_imports)]
282 use super::*;
283
284 /// The street address that you want to search for. Specify addresses in
285 /// accordance with the format used by the national postal service of the
286 /// country concerned.
287 #[derive(Clone, Default, PartialEq)]
288 #[non_exhaustive]
289 pub struct AddressQuery {
290 /// The address query.
291 pub kind:
292 std::option::Option<crate::model::search_destinations_request::address_query::Kind>,
293
294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
295 }
296
297 impl AddressQuery {
298 /// Creates a new default instance.
299 pub fn new() -> Self {
300 std::default::Default::default()
301 }
302
303 /// Sets the value of [kind][crate::model::search_destinations_request::AddressQuery::kind].
304 ///
305 /// Note that all the setters affecting `kind` are mutually
306 /// exclusive.
307 ///
308 /// # Example
309 /// ```ignore,no_run
310 /// # use google_maps_geocode_v4::model::search_destinations_request::AddressQuery;
311 /// use google_maps_geocode_v4::model::search_destinations_request::address_query::Kind;
312 /// let x = AddressQuery::new().set_kind(Some(Kind::AddressQuery("example".to_string())));
313 /// ```
314 pub fn set_kind<
315 T: std::convert::Into<
316 std::option::Option<
317 crate::model::search_destinations_request::address_query::Kind,
318 >,
319 >,
320 >(
321 mut self,
322 v: T,
323 ) -> Self {
324 self.kind = v.into();
325 self
326 }
327
328 /// The value of [kind][crate::model::search_destinations_request::AddressQuery::kind]
329 /// if it holds a `Address`, `None` if the field is not set or
330 /// holds a different branch.
331 pub fn address(
332 &self,
333 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
334 {
335 #[allow(unreachable_patterns)]
336 self.kind.as_ref().and_then(|v| match v {
337 crate::model::search_destinations_request::address_query::Kind::Address(v) => {
338 std::option::Option::Some(v)
339 }
340 _ => std::option::Option::None,
341 })
342 }
343
344 /// Sets the value of [kind][crate::model::search_destinations_request::AddressQuery::kind]
345 /// to hold a `Address`.
346 ///
347 /// Note that all the setters affecting `kind` are
348 /// mutually exclusive.
349 ///
350 /// # Example
351 /// ```ignore,no_run
352 /// # use google_maps_geocode_v4::model::search_destinations_request::AddressQuery;
353 /// use google_cloud_type::model::PostalAddress;
354 /// let x = AddressQuery::new().set_address(PostalAddress::default()/* use setters */);
355 /// assert!(x.address().is_some());
356 /// assert!(x.address_query().is_none());
357 /// ```
358 pub fn set_address<
359 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
360 >(
361 mut self,
362 v: T,
363 ) -> Self {
364 self.kind = std::option::Option::Some(
365 crate::model::search_destinations_request::address_query::Kind::Address(v.into()),
366 );
367 self
368 }
369
370 /// The value of [kind][crate::model::search_destinations_request::AddressQuery::kind]
371 /// if it holds a `AddressQuery`, `None` if the field is not set or
372 /// holds a different branch.
373 pub fn address_query(&self) -> std::option::Option<&std::string::String> {
374 #[allow(unreachable_patterns)]
375 self.kind.as_ref().and_then(|v| match v {
376 crate::model::search_destinations_request::address_query::Kind::AddressQuery(v) => {
377 std::option::Option::Some(v)
378 }
379 _ => std::option::Option::None,
380 })
381 }
382
383 /// Sets the value of [kind][crate::model::search_destinations_request::AddressQuery::kind]
384 /// to hold a `AddressQuery`.
385 ///
386 /// Note that all the setters affecting `kind` are
387 /// mutually exclusive.
388 ///
389 /// # Example
390 /// ```ignore,no_run
391 /// # use google_maps_geocode_v4::model::search_destinations_request::AddressQuery;
392 /// let x = AddressQuery::new().set_address_query("example");
393 /// assert!(x.address_query().is_some());
394 /// assert!(x.address().is_none());
395 /// ```
396 pub fn set_address_query<T: std::convert::Into<std::string::String>>(
397 mut self,
398 v: T,
399 ) -> Self {
400 self.kind = std::option::Option::Some(
401 crate::model::search_destinations_request::address_query::Kind::AddressQuery(
402 v.into(),
403 ),
404 );
405 self
406 }
407 }
408
409 impl wkt::message::Message for AddressQuery {
410 fn typename() -> &'static str {
411 "type.googleapis.com/google.maps.geocode.v4.SearchDestinationsRequest.AddressQuery"
412 }
413 }
414
415 /// Defines additional types related to [AddressQuery].
416 pub mod address_query {
417 #[allow(unused_imports)]
418 use super::*;
419
420 /// The address query.
421 #[derive(Clone, Debug, PartialEq)]
422 #[non_exhaustive]
423 pub enum Kind {
424 /// A street address in postal address format.
425 Address(std::boxed::Box<google_cloud_type::model::PostalAddress>),
426 /// A street address formatted as a single line.
427 AddressQuery(std::string::String),
428 }
429 }
430
431 /// A location query to identify a nearby primary destination.
432 ///
433 /// Note: if the location query is within a building that contains subpremises,
434 /// it is possible that the returned primary place is a subpremise. In these
435 /// cases, the `containing_places` field will include the building.
436 #[derive(Clone, Default, PartialEq)]
437 #[non_exhaustive]
438 pub struct LocationQuery {
439 /// Optional. Filters to apply to destination candidates.
440 pub place_filter: std::option::Option<
441 crate::model::search_destinations_request::location_query::PlaceFilter,
442 >,
443
444 /// The location query.
445 pub kind:
446 std::option::Option<crate::model::search_destinations_request::location_query::Kind>,
447
448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
449 }
450
451 impl LocationQuery {
452 /// Creates a new default instance.
453 pub fn new() -> Self {
454 std::default::Default::default()
455 }
456
457 /// Sets the value of [place_filter][crate::model::search_destinations_request::LocationQuery::place_filter].
458 ///
459 /// # Example
460 /// ```ignore,no_run
461 /// # use google_maps_geocode_v4::model::search_destinations_request::LocationQuery;
462 /// use google_maps_geocode_v4::model::search_destinations_request::location_query::PlaceFilter;
463 /// let x = LocationQuery::new().set_place_filter(PlaceFilter::default()/* use setters */);
464 /// ```
465 pub fn set_place_filter<T>(mut self, v: T) -> Self
466 where
467 T: std::convert::Into<
468 crate::model::search_destinations_request::location_query::PlaceFilter,
469 >,
470 {
471 self.place_filter = std::option::Option::Some(v.into());
472 self
473 }
474
475 /// Sets or clears the value of [place_filter][crate::model::search_destinations_request::LocationQuery::place_filter].
476 ///
477 /// # Example
478 /// ```ignore,no_run
479 /// # use google_maps_geocode_v4::model::search_destinations_request::LocationQuery;
480 /// use google_maps_geocode_v4::model::search_destinations_request::location_query::PlaceFilter;
481 /// let x = LocationQuery::new().set_or_clear_place_filter(Some(PlaceFilter::default()/* use setters */));
482 /// let x = LocationQuery::new().set_or_clear_place_filter(None::<PlaceFilter>);
483 /// ```
484 pub fn set_or_clear_place_filter<T>(mut self, v: std::option::Option<T>) -> Self
485 where
486 T: std::convert::Into<
487 crate::model::search_destinations_request::location_query::PlaceFilter,
488 >,
489 {
490 self.place_filter = v.map(|x| x.into());
491 self
492 }
493
494 /// Sets the value of [kind][crate::model::search_destinations_request::LocationQuery::kind].
495 ///
496 /// Note that all the setters affecting `kind` are mutually
497 /// exclusive.
498 ///
499 /// # Example
500 /// ```ignore,no_run
501 /// # use google_maps_geocode_v4::model::search_destinations_request::LocationQuery;
502 /// use google_cloud_type::model::LatLng;
503 /// let x = LocationQuery::new().set_kind(Some(
504 /// google_maps_geocode_v4::model::search_destinations_request::location_query::Kind::Location(LatLng::default().into())));
505 /// ```
506 pub fn set_kind<
507 T: std::convert::Into<
508 std::option::Option<
509 crate::model::search_destinations_request::location_query::Kind,
510 >,
511 >,
512 >(
513 mut self,
514 v: T,
515 ) -> Self {
516 self.kind = v.into();
517 self
518 }
519
520 /// The value of [kind][crate::model::search_destinations_request::LocationQuery::kind]
521 /// if it holds a `Location`, `None` if the field is not set or
522 /// holds a different branch.
523 pub fn location(
524 &self,
525 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::LatLng>> {
526 #[allow(unreachable_patterns)]
527 self.kind.as_ref().and_then(|v| match v {
528 crate::model::search_destinations_request::location_query::Kind::Location(v) => {
529 std::option::Option::Some(v)
530 }
531 _ => std::option::Option::None,
532 })
533 }
534
535 /// Sets the value of [kind][crate::model::search_destinations_request::LocationQuery::kind]
536 /// to hold a `Location`.
537 ///
538 /// Note that all the setters affecting `kind` are
539 /// mutually exclusive.
540 ///
541 /// # Example
542 /// ```ignore,no_run
543 /// # use google_maps_geocode_v4::model::search_destinations_request::LocationQuery;
544 /// use google_cloud_type::model::LatLng;
545 /// let x = LocationQuery::new().set_location(LatLng::default()/* use setters */);
546 /// assert!(x.location().is_some());
547 /// ```
548 pub fn set_location<
549 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::LatLng>>,
550 >(
551 mut self,
552 v: T,
553 ) -> Self {
554 self.kind = std::option::Option::Some(
555 crate::model::search_destinations_request::location_query::Kind::Location(v.into()),
556 );
557 self
558 }
559 }
560
561 impl wkt::message::Message for LocationQuery {
562 fn typename() -> &'static str {
563 "type.googleapis.com/google.maps.geocode.v4.SearchDestinationsRequest.LocationQuery"
564 }
565 }
566
567 /// Defines additional types related to [LocationQuery].
568 pub mod location_query {
569 #[allow(unused_imports)]
570 use super::*;
571
572 /// Filters to apply to destination candidates.
573 #[derive(Clone, Default, PartialEq)]
574 #[non_exhaustive]
575 pub struct PlaceFilter {
576
577 /// Optional. If specified, all destinations are guaranteed to have a
578 /// primary place with this structure type. This can result in filtering
579 /// out some destinations, or in coarsening/refining the returned
580 /// destinations.
581 ///
582 /// For example, if `GROUNDS` is specified, all returned destinations will
583 /// have a primary place with the `GROUNDS` structure type. This can
584 /// result in filtering out some destinations that are not part of a
585 /// grounds, or in coarsening the returned destinations to the grounds
586 /// level.
587 ///
588 /// Another use of this field is to more easily extract building display
589 /// polygons. For example, if `BUILDING` is specified, the primary place's
590 /// display polygon will be for the building at the specified location.
591 pub structure_type: crate::model::place_view::StructureType,
592
593 /// Optional. If specified, only returns destinations that meet the
594 /// corresponding addressability criteria.
595 pub addressability: crate::model::search_destinations_request::location_query::place_filter::Addressability,
596
597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
598 }
599
600 impl PlaceFilter {
601 /// Creates a new default instance.
602 pub fn new() -> Self {
603 std::default::Default::default()
604 }
605
606 /// Sets the value of [structure_type][crate::model::search_destinations_request::location_query::PlaceFilter::structure_type].
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_maps_geocode_v4::model::search_destinations_request::location_query::PlaceFilter;
611 /// use google_maps_geocode_v4::model::place_view::StructureType;
612 /// let x0 = PlaceFilter::new().set_structure_type(StructureType::Point);
613 /// let x1 = PlaceFilter::new().set_structure_type(StructureType::Section);
614 /// let x2 = PlaceFilter::new().set_structure_type(StructureType::Building);
615 /// ```
616 pub fn set_structure_type<
617 T: std::convert::Into<crate::model::place_view::StructureType>,
618 >(
619 mut self,
620 v: T,
621 ) -> Self {
622 self.structure_type = v.into();
623 self
624 }
625
626 /// Sets the value of [addressability][crate::model::search_destinations_request::location_query::PlaceFilter::addressability].
627 ///
628 /// # Example
629 /// ```ignore,no_run
630 /// # use google_maps_geocode_v4::model::search_destinations_request::location_query::PlaceFilter;
631 /// use google_maps_geocode_v4::model::search_destinations_request::location_query::place_filter::Addressability;
632 /// let x0 = PlaceFilter::new().set_addressability(Addressability::Any);
633 /// let x1 = PlaceFilter::new().set_addressability(Addressability::Primary);
634 /// let x2 = PlaceFilter::new().set_addressability(Addressability::Weak);
635 /// ```
636 pub fn set_addressability<T: std::convert::Into<crate::model::search_destinations_request::location_query::place_filter::Addressability>>(mut self, v: T) -> Self{
637 self.addressability = v.into();
638 self
639 }
640 }
641
642 impl wkt::message::Message for PlaceFilter {
643 fn typename() -> &'static str {
644 "type.googleapis.com/google.maps.geocode.v4.SearchDestinationsRequest.LocationQuery.PlaceFilter"
645 }
646 }
647
648 /// Defines additional types related to [PlaceFilter].
649 pub mod place_filter {
650 #[allow(unused_imports)]
651 use super::*;
652
653 /// Defines options for addressability filtering. New values may be added
654 /// in the future.
655 ///
656 /// # Working with unknown values
657 ///
658 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
659 /// additional enum variants at any time. Adding new variants is not considered
660 /// a breaking change. Applications should write their code in anticipation of:
661 ///
662 /// - New values appearing in future releases of the client library, **and**
663 /// - New values received dynamically, without application changes.
664 ///
665 /// Please consult the [Working with enums] section in the user guide for some
666 /// guidelines.
667 ///
668 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
669 #[derive(Clone, Debug, PartialEq)]
670 #[non_exhaustive]
671 pub enum Addressability {
672 /// When unspecified, the service will choose a sensible default.
673 Unspecified,
674 /// Addressability is not a filtering criteria. Destinations are returned
675 /// regardless of their addressability.
676 Any,
677 /// All destinations returned will have a primary place with a street
678 /// level address or name.
679 Primary,
680 /// All destinations returned will have either a primary place or a
681 /// subdestination with a street level address or name.
682 Weak,
683 /// If set, the enum was initialized with an unknown value.
684 ///
685 /// Applications can examine the value using [Addressability::value] or
686 /// [Addressability::name].
687 UnknownValue(addressability::UnknownValue),
688 }
689
690 #[doc(hidden)]
691 pub mod addressability {
692 #[allow(unused_imports)]
693 use super::*;
694 #[derive(Clone, Debug, PartialEq)]
695 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
696 }
697
698 impl Addressability {
699 /// Gets the enum value.
700 ///
701 /// Returns `None` if the enum contains an unknown value deserialized from
702 /// the string representation of enums.
703 pub fn value(&self) -> std::option::Option<i32> {
704 match self {
705 Self::Unspecified => std::option::Option::Some(0),
706 Self::Any => std::option::Option::Some(1),
707 Self::Primary => std::option::Option::Some(2),
708 Self::Weak => std::option::Option::Some(3),
709 Self::UnknownValue(u) => u.0.value(),
710 }
711 }
712
713 /// Gets the enum value as a string.
714 ///
715 /// Returns `None` if the enum contains an unknown value deserialized from
716 /// the integer representation of enums.
717 pub fn name(&self) -> std::option::Option<&str> {
718 match self {
719 Self::Unspecified => {
720 std::option::Option::Some("ADDRESSABILITY_UNSPECIFIED")
721 }
722 Self::Any => std::option::Option::Some("ANY"),
723 Self::Primary => std::option::Option::Some("PRIMARY"),
724 Self::Weak => std::option::Option::Some("WEAK"),
725 Self::UnknownValue(u) => u.0.name(),
726 }
727 }
728 }
729
730 impl std::default::Default for Addressability {
731 fn default() -> Self {
732 use std::convert::From;
733 Self::from(0)
734 }
735 }
736
737 impl std::fmt::Display for Addressability {
738 fn fmt(
739 &self,
740 f: &mut std::fmt::Formatter<'_>,
741 ) -> std::result::Result<(), std::fmt::Error> {
742 wkt::internal::display_enum(f, self.name(), self.value())
743 }
744 }
745
746 impl std::convert::From<i32> for Addressability {
747 fn from(value: i32) -> Self {
748 match value {
749 0 => Self::Unspecified,
750 1 => Self::Any,
751 2 => Self::Primary,
752 3 => Self::Weak,
753 _ => Self::UnknownValue(addressability::UnknownValue(
754 wkt::internal::UnknownEnumValue::Integer(value),
755 )),
756 }
757 }
758 }
759
760 impl std::convert::From<&str> for Addressability {
761 fn from(value: &str) -> Self {
762 use std::string::ToString;
763 match value {
764 "ADDRESSABILITY_UNSPECIFIED" => Self::Unspecified,
765 "ANY" => Self::Any,
766 "PRIMARY" => Self::Primary,
767 "WEAK" => Self::Weak,
768 _ => Self::UnknownValue(addressability::UnknownValue(
769 wkt::internal::UnknownEnumValue::String(value.to_string()),
770 )),
771 }
772 }
773 }
774
775 impl serde::ser::Serialize for Addressability {
776 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
777 where
778 S: serde::Serializer,
779 {
780 match self {
781 Self::Unspecified => serializer.serialize_i32(0),
782 Self::Any => serializer.serialize_i32(1),
783 Self::Primary => serializer.serialize_i32(2),
784 Self::Weak => serializer.serialize_i32(3),
785 Self::UnknownValue(u) => u.0.serialize(serializer),
786 }
787 }
788 }
789
790 impl<'de> serde::de::Deserialize<'de> for Addressability {
791 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
792 where
793 D: serde::Deserializer<'de>,
794 {
795 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Addressability>::new(
796 ".google.maps.geocode.v4.SearchDestinationsRequest.LocationQuery.PlaceFilter.Addressability"))
797 }
798 }
799 }
800
801 /// The location query.
802 #[derive(Clone, Debug, PartialEq)]
803 #[non_exhaustive]
804 pub enum Kind {
805 /// A precise LatLng location.
806 Location(std::boxed::Box<google_cloud_type::model::LatLng>),
807 }
808 }
809
810 /// Query for the primary destination. This can be either a place, a fully
811 /// specified address, or a LatLng location. Some places and addresses with
812 /// minimal information won't be able to be turned into a destination.
813 ///
814 /// The destinations are built around the specified primary query.
815 ///
816 /// Note: only places and addresses that can have a navigational destination
817 /// are supported. For example, a place that represents a house or an apartment
818 /// complex can be used as the primary query, but places that represent a
819 /// locality or an administrative area cannot be used as the primary query.
820 #[derive(Clone, Debug, PartialEq)]
821 #[non_exhaustive]
822 pub enum PrimaryQuery {
823 /// The resource name of a place, in `places/{place_id}` format.
824 Place(std::string::String),
825 /// A street address.
826 AddressQuery(std::boxed::Box<crate::model::search_destinations_request::AddressQuery>),
827 /// A precise location.
828 LocationQuery(std::boxed::Box<crate::model::search_destinations_request::LocationQuery>),
829 }
830}
831
832/// Response message for DestinationService.SearchDestinations.
833#[derive(Clone, Default, PartialEq)]
834#[non_exhaustive]
835pub struct SearchDestinationsResponse {
836 /// A list of destinations.
837 ///
838 /// The service returns one result if a primary destination can be
839 /// unambiguously identified from the primary query. Otherwise, the service
840 /// might return multiple results for disambiguation or zero results.
841 pub destinations: std::vec::Vec<crate::model::Destination>,
842
843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
844}
845
846impl SearchDestinationsResponse {
847 /// Creates a new default instance.
848 pub fn new() -> Self {
849 std::default::Default::default()
850 }
851
852 /// Sets the value of [destinations][crate::model::SearchDestinationsResponse::destinations].
853 ///
854 /// # Example
855 /// ```ignore,no_run
856 /// # use google_maps_geocode_v4::model::SearchDestinationsResponse;
857 /// use google_maps_geocode_v4::model::Destination;
858 /// let x = SearchDestinationsResponse::new()
859 /// .set_destinations([
860 /// Destination::default()/* use setters */,
861 /// Destination::default()/* use (different) setters */,
862 /// ]);
863 /// ```
864 pub fn set_destinations<T, V>(mut self, v: T) -> Self
865 where
866 T: std::iter::IntoIterator<Item = V>,
867 V: std::convert::Into<crate::model::Destination>,
868 {
869 use std::iter::Iterator;
870 self.destinations = v.into_iter().map(|i| i.into()).collect();
871 self
872 }
873}
874
875impl wkt::message::Message for SearchDestinationsResponse {
876 fn typename() -> &'static str {
877 "type.googleapis.com/google.maps.geocode.v4.SearchDestinationsResponse"
878 }
879}
880
881/// A destination. This includes the primary place, related places,
882/// entrances, and navigation points.
883#[derive(Clone, Default, PartialEq)]
884#[non_exhaustive]
885pub struct Destination {
886 /// The primary place identified by the `primary_query` in the request.
887 pub primary: std::option::Option<crate::model::PlaceView>,
888
889 /// The less precise places that the primary place is contained by.
890 /// For example, the apartment complex that contains this building.
891 pub containing_places: std::vec::Vec<crate::model::PlaceView>,
892
893 /// More precise sub-destinations of the primary place. For example, units
894 /// contained in a building.
895 ///
896 /// Note: compared to the
897 /// [SubDestination](/maps/documentation/places/web-service/reference/rest/v1/places#SubDestination)
898 /// returned by the Places API, this list of sub-destinations is more
899 /// exhaustive, and each sub-destination contains more information.
900 pub sub_destinations: std::vec::Vec<crate::model::PlaceView>,
901
902 /// Landmarks that can be used to communicate where the destination is
903 /// or help with arrival.
904 pub landmarks: std::vec::Vec<crate::model::Landmark>,
905
906 /// Entrances for this destination.
907 pub entrances: std::vec::Vec<crate::model::Entrance>,
908
909 /// Navigation points for this destination.
910 pub navigation_points: std::vec::Vec<crate::model::NavigationPoint>,
911
912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
913}
914
915impl Destination {
916 /// Creates a new default instance.
917 pub fn new() -> Self {
918 std::default::Default::default()
919 }
920
921 /// Sets the value of [primary][crate::model::Destination::primary].
922 ///
923 /// # Example
924 /// ```ignore,no_run
925 /// # use google_maps_geocode_v4::model::Destination;
926 /// use google_maps_geocode_v4::model::PlaceView;
927 /// let x = Destination::new().set_primary(PlaceView::default()/* use setters */);
928 /// ```
929 pub fn set_primary<T>(mut self, v: T) -> Self
930 where
931 T: std::convert::Into<crate::model::PlaceView>,
932 {
933 self.primary = std::option::Option::Some(v.into());
934 self
935 }
936
937 /// Sets or clears the value of [primary][crate::model::Destination::primary].
938 ///
939 /// # Example
940 /// ```ignore,no_run
941 /// # use google_maps_geocode_v4::model::Destination;
942 /// use google_maps_geocode_v4::model::PlaceView;
943 /// let x = Destination::new().set_or_clear_primary(Some(PlaceView::default()/* use setters */));
944 /// let x = Destination::new().set_or_clear_primary(None::<PlaceView>);
945 /// ```
946 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
947 where
948 T: std::convert::Into<crate::model::PlaceView>,
949 {
950 self.primary = v.map(|x| x.into());
951 self
952 }
953
954 /// Sets the value of [containing_places][crate::model::Destination::containing_places].
955 ///
956 /// # Example
957 /// ```ignore,no_run
958 /// # use google_maps_geocode_v4::model::Destination;
959 /// use google_maps_geocode_v4::model::PlaceView;
960 /// let x = Destination::new()
961 /// .set_containing_places([
962 /// PlaceView::default()/* use setters */,
963 /// PlaceView::default()/* use (different) setters */,
964 /// ]);
965 /// ```
966 pub fn set_containing_places<T, V>(mut self, v: T) -> Self
967 where
968 T: std::iter::IntoIterator<Item = V>,
969 V: std::convert::Into<crate::model::PlaceView>,
970 {
971 use std::iter::Iterator;
972 self.containing_places = v.into_iter().map(|i| i.into()).collect();
973 self
974 }
975
976 /// Sets the value of [sub_destinations][crate::model::Destination::sub_destinations].
977 ///
978 /// # Example
979 /// ```ignore,no_run
980 /// # use google_maps_geocode_v4::model::Destination;
981 /// use google_maps_geocode_v4::model::PlaceView;
982 /// let x = Destination::new()
983 /// .set_sub_destinations([
984 /// PlaceView::default()/* use setters */,
985 /// PlaceView::default()/* use (different) setters */,
986 /// ]);
987 /// ```
988 pub fn set_sub_destinations<T, V>(mut self, v: T) -> Self
989 where
990 T: std::iter::IntoIterator<Item = V>,
991 V: std::convert::Into<crate::model::PlaceView>,
992 {
993 use std::iter::Iterator;
994 self.sub_destinations = v.into_iter().map(|i| i.into()).collect();
995 self
996 }
997
998 /// Sets the value of [landmarks][crate::model::Destination::landmarks].
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_maps_geocode_v4::model::Destination;
1003 /// use google_maps_geocode_v4::model::Landmark;
1004 /// let x = Destination::new()
1005 /// .set_landmarks([
1006 /// Landmark::default()/* use setters */,
1007 /// Landmark::default()/* use (different) setters */,
1008 /// ]);
1009 /// ```
1010 pub fn set_landmarks<T, V>(mut self, v: T) -> Self
1011 where
1012 T: std::iter::IntoIterator<Item = V>,
1013 V: std::convert::Into<crate::model::Landmark>,
1014 {
1015 use std::iter::Iterator;
1016 self.landmarks = v.into_iter().map(|i| i.into()).collect();
1017 self
1018 }
1019
1020 /// Sets the value of [entrances][crate::model::Destination::entrances].
1021 ///
1022 /// # Example
1023 /// ```ignore,no_run
1024 /// # use google_maps_geocode_v4::model::Destination;
1025 /// use google_maps_geocode_v4::model::Entrance;
1026 /// let x = Destination::new()
1027 /// .set_entrances([
1028 /// Entrance::default()/* use setters */,
1029 /// Entrance::default()/* use (different) setters */,
1030 /// ]);
1031 /// ```
1032 pub fn set_entrances<T, V>(mut self, v: T) -> Self
1033 where
1034 T: std::iter::IntoIterator<Item = V>,
1035 V: std::convert::Into<crate::model::Entrance>,
1036 {
1037 use std::iter::Iterator;
1038 self.entrances = v.into_iter().map(|i| i.into()).collect();
1039 self
1040 }
1041
1042 /// Sets the value of [navigation_points][crate::model::Destination::navigation_points].
1043 ///
1044 /// # Example
1045 /// ```ignore,no_run
1046 /// # use google_maps_geocode_v4::model::Destination;
1047 /// use google_maps_geocode_v4::model::NavigationPoint;
1048 /// let x = Destination::new()
1049 /// .set_navigation_points([
1050 /// NavigationPoint::default()/* use setters */,
1051 /// NavigationPoint::default()/* use (different) setters */,
1052 /// ]);
1053 /// ```
1054 pub fn set_navigation_points<T, V>(mut self, v: T) -> Self
1055 where
1056 T: std::iter::IntoIterator<Item = V>,
1057 V: std::convert::Into<crate::model::NavigationPoint>,
1058 {
1059 use std::iter::Iterator;
1060 self.navigation_points = v.into_iter().map(|i| i.into()).collect();
1061 self
1062 }
1063}
1064
1065impl wkt::message::Message for Destination {
1066 fn typename() -> &'static str {
1067 "type.googleapis.com/google.maps.geocode.v4.Destination"
1068 }
1069}
1070
1071/// Represents a view of a
1072/// [Place](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/places#resource:-place)
1073/// in the Places API. It also provides additional information specific to
1074/// destinations, such as the structure type and the display polygon.
1075///
1076/// In some cases, a `PlaceView` with the same place ID might differ from what
1077/// is being returned by the Places API for the `types` and
1078/// `display_name` fields.
1079#[derive(Clone, Default, PartialEq)]
1080#[non_exhaustive]
1081pub struct PlaceView {
1082 /// This Place's resource name, in `places/{placeId}` format. Can be used to
1083 /// look up the Place.
1084 pub place: std::string::String,
1085
1086 /// The unique identifier of a place.
1087 pub place_id: std::string::String,
1088
1089 /// Human readable place description. For example, "Gate B", "McDonalds"
1090 pub display_name: std::option::Option<google_cloud_type::model::LocalizedText>,
1091
1092 /// The primary place type of this place. See
1093 /// <https://developers.google.com/maps/documentation/places/web-service/place-types>
1094 /// for the list of possible values.
1095 ///
1096 /// Note: This field is not always populated. Be prepared to use the `types`
1097 /// field in such situations.
1098 pub primary_type: std::string::String,
1099
1100 /// All associated place types of this place. See
1101 /// <https://developers.google.com/maps/documentation/places/web-service/place-types>
1102 /// for the list of possible values.
1103 pub types: std::vec::Vec<std::string::String>,
1104
1105 /// One line address.
1106 pub formatted_address: std::string::String,
1107
1108 /// Structured address.
1109 pub postal_address: std::option::Option<google_cloud_type::model::PostalAddress>,
1110
1111 /// The type of structure corresponding to this place.
1112 pub structure_type: crate::model::place_view::StructureType,
1113
1114 /// The location of this place. For places with display polygons, this can
1115 /// represent a good spot to put a marker on the map.
1116 pub location: std::option::Option<google_cloud_type::model::LatLng>,
1117
1118 /// The polygon outline of the place in GeoJSON format, using the RFC 7946
1119 /// format: <https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6>.
1120 ///
1121 /// Note: The RFC 7946 format supports MultiPolygons, so one `display_polygon`
1122 /// object can represent multiple polygons.
1123 pub display_polygon: std::option::Option<wkt::Struct>,
1124
1125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1126}
1127
1128impl PlaceView {
1129 /// Creates a new default instance.
1130 pub fn new() -> Self {
1131 std::default::Default::default()
1132 }
1133
1134 /// Sets the value of [place][crate::model::PlaceView::place].
1135 ///
1136 /// # Example
1137 /// ```ignore,no_run
1138 /// # use google_maps_geocode_v4::model::PlaceView;
1139 /// let x = PlaceView::new().set_place("example");
1140 /// ```
1141 pub fn set_place<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1142 self.place = v.into();
1143 self
1144 }
1145
1146 /// Sets the value of [place_id][crate::model::PlaceView::place_id].
1147 ///
1148 /// # Example
1149 /// ```ignore,no_run
1150 /// # use google_maps_geocode_v4::model::PlaceView;
1151 /// let x = PlaceView::new().set_place_id("example");
1152 /// ```
1153 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1154 self.place_id = v.into();
1155 self
1156 }
1157
1158 /// Sets the value of [display_name][crate::model::PlaceView::display_name].
1159 ///
1160 /// # Example
1161 /// ```ignore,no_run
1162 /// # use google_maps_geocode_v4::model::PlaceView;
1163 /// use google_cloud_type::model::LocalizedText;
1164 /// let x = PlaceView::new().set_display_name(LocalizedText::default()/* use setters */);
1165 /// ```
1166 pub fn set_display_name<T>(mut self, v: T) -> Self
1167 where
1168 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
1169 {
1170 self.display_name = std::option::Option::Some(v.into());
1171 self
1172 }
1173
1174 /// Sets or clears the value of [display_name][crate::model::PlaceView::display_name].
1175 ///
1176 /// # Example
1177 /// ```ignore,no_run
1178 /// # use google_maps_geocode_v4::model::PlaceView;
1179 /// use google_cloud_type::model::LocalizedText;
1180 /// let x = PlaceView::new().set_or_clear_display_name(Some(LocalizedText::default()/* use setters */));
1181 /// let x = PlaceView::new().set_or_clear_display_name(None::<LocalizedText>);
1182 /// ```
1183 pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
1184 where
1185 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
1186 {
1187 self.display_name = v.map(|x| x.into());
1188 self
1189 }
1190
1191 /// Sets the value of [primary_type][crate::model::PlaceView::primary_type].
1192 ///
1193 /// # Example
1194 /// ```ignore,no_run
1195 /// # use google_maps_geocode_v4::model::PlaceView;
1196 /// let x = PlaceView::new().set_primary_type("example");
1197 /// ```
1198 pub fn set_primary_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1199 self.primary_type = v.into();
1200 self
1201 }
1202
1203 /// Sets the value of [types][crate::model::PlaceView::types].
1204 ///
1205 /// # Example
1206 /// ```ignore,no_run
1207 /// # use google_maps_geocode_v4::model::PlaceView;
1208 /// let x = PlaceView::new().set_types(["a", "b", "c"]);
1209 /// ```
1210 pub fn set_types<T, V>(mut self, v: T) -> Self
1211 where
1212 T: std::iter::IntoIterator<Item = V>,
1213 V: std::convert::Into<std::string::String>,
1214 {
1215 use std::iter::Iterator;
1216 self.types = v.into_iter().map(|i| i.into()).collect();
1217 self
1218 }
1219
1220 /// Sets the value of [formatted_address][crate::model::PlaceView::formatted_address].
1221 ///
1222 /// # Example
1223 /// ```ignore,no_run
1224 /// # use google_maps_geocode_v4::model::PlaceView;
1225 /// let x = PlaceView::new().set_formatted_address("example");
1226 /// ```
1227 pub fn set_formatted_address<T: std::convert::Into<std::string::String>>(
1228 mut self,
1229 v: T,
1230 ) -> Self {
1231 self.formatted_address = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [postal_address][crate::model::PlaceView::postal_address].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_maps_geocode_v4::model::PlaceView;
1240 /// use google_cloud_type::model::PostalAddress;
1241 /// let x = PlaceView::new().set_postal_address(PostalAddress::default()/* use setters */);
1242 /// ```
1243 pub fn set_postal_address<T>(mut self, v: T) -> Self
1244 where
1245 T: std::convert::Into<google_cloud_type::model::PostalAddress>,
1246 {
1247 self.postal_address = std::option::Option::Some(v.into());
1248 self
1249 }
1250
1251 /// Sets or clears the value of [postal_address][crate::model::PlaceView::postal_address].
1252 ///
1253 /// # Example
1254 /// ```ignore,no_run
1255 /// # use google_maps_geocode_v4::model::PlaceView;
1256 /// use google_cloud_type::model::PostalAddress;
1257 /// let x = PlaceView::new().set_or_clear_postal_address(Some(PostalAddress::default()/* use setters */));
1258 /// let x = PlaceView::new().set_or_clear_postal_address(None::<PostalAddress>);
1259 /// ```
1260 pub fn set_or_clear_postal_address<T>(mut self, v: std::option::Option<T>) -> Self
1261 where
1262 T: std::convert::Into<google_cloud_type::model::PostalAddress>,
1263 {
1264 self.postal_address = v.map(|x| x.into());
1265 self
1266 }
1267
1268 /// Sets the value of [structure_type][crate::model::PlaceView::structure_type].
1269 ///
1270 /// # Example
1271 /// ```ignore,no_run
1272 /// # use google_maps_geocode_v4::model::PlaceView;
1273 /// use google_maps_geocode_v4::model::place_view::StructureType;
1274 /// let x0 = PlaceView::new().set_structure_type(StructureType::Point);
1275 /// let x1 = PlaceView::new().set_structure_type(StructureType::Section);
1276 /// let x2 = PlaceView::new().set_structure_type(StructureType::Building);
1277 /// ```
1278 pub fn set_structure_type<T: std::convert::Into<crate::model::place_view::StructureType>>(
1279 mut self,
1280 v: T,
1281 ) -> Self {
1282 self.structure_type = v.into();
1283 self
1284 }
1285
1286 /// Sets the value of [location][crate::model::PlaceView::location].
1287 ///
1288 /// # Example
1289 /// ```ignore,no_run
1290 /// # use google_maps_geocode_v4::model::PlaceView;
1291 /// use google_cloud_type::model::LatLng;
1292 /// let x = PlaceView::new().set_location(LatLng::default()/* use setters */);
1293 /// ```
1294 pub fn set_location<T>(mut self, v: T) -> Self
1295 where
1296 T: std::convert::Into<google_cloud_type::model::LatLng>,
1297 {
1298 self.location = std::option::Option::Some(v.into());
1299 self
1300 }
1301
1302 /// Sets or clears the value of [location][crate::model::PlaceView::location].
1303 ///
1304 /// # Example
1305 /// ```ignore,no_run
1306 /// # use google_maps_geocode_v4::model::PlaceView;
1307 /// use google_cloud_type::model::LatLng;
1308 /// let x = PlaceView::new().set_or_clear_location(Some(LatLng::default()/* use setters */));
1309 /// let x = PlaceView::new().set_or_clear_location(None::<LatLng>);
1310 /// ```
1311 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
1312 where
1313 T: std::convert::Into<google_cloud_type::model::LatLng>,
1314 {
1315 self.location = v.map(|x| x.into());
1316 self
1317 }
1318
1319 /// Sets the value of [display_polygon][crate::model::PlaceView::display_polygon].
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_maps_geocode_v4::model::PlaceView;
1324 /// use wkt::Struct;
1325 /// let x = PlaceView::new().set_display_polygon(Struct::default()/* use setters */);
1326 /// ```
1327 pub fn set_display_polygon<T>(mut self, v: T) -> Self
1328 where
1329 T: std::convert::Into<wkt::Struct>,
1330 {
1331 self.display_polygon = std::option::Option::Some(v.into());
1332 self
1333 }
1334
1335 /// Sets or clears the value of [display_polygon][crate::model::PlaceView::display_polygon].
1336 ///
1337 /// # Example
1338 /// ```ignore,no_run
1339 /// # use google_maps_geocode_v4::model::PlaceView;
1340 /// use wkt::Struct;
1341 /// let x = PlaceView::new().set_or_clear_display_polygon(Some(Struct::default()/* use setters */));
1342 /// let x = PlaceView::new().set_or_clear_display_polygon(None::<Struct>);
1343 /// ```
1344 pub fn set_or_clear_display_polygon<T>(mut self, v: std::option::Option<T>) -> Self
1345 where
1346 T: std::convert::Into<wkt::Struct>,
1347 {
1348 self.display_polygon = v.map(|x| x.into());
1349 self
1350 }
1351}
1352
1353impl wkt::message::Message for PlaceView {
1354 fn typename() -> &'static str {
1355 "type.googleapis.com/google.maps.geocode.v4.PlaceView"
1356 }
1357}
1358
1359/// Defines additional types related to [PlaceView].
1360pub mod place_view {
1361 #[allow(unused_imports)]
1362 use super::*;
1363
1364 /// The type of structure that this place represents.
1365 ///
1366 /// # Working with unknown values
1367 ///
1368 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1369 /// additional enum variants at any time. Adding new variants is not considered
1370 /// a breaking change. Applications should write their code in anticipation of:
1371 ///
1372 /// - New values appearing in future releases of the client library, **and**
1373 /// - New values received dynamically, without application changes.
1374 ///
1375 /// Please consult the [Working with enums] section in the user guide for some
1376 /// guidelines.
1377 ///
1378 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1379 #[derive(Clone, Debug, PartialEq)]
1380 #[non_exhaustive]
1381 pub enum StructureType {
1382 /// Not used.
1383 Unspecified,
1384 /// A point location.
1385 Point,
1386 /// A sub-section of a building.
1387 Section,
1388 /// A building.
1389 Building,
1390 /// A large area that typically contains multiple buildings, such as a
1391 /// university campus, an apartment complex, or a shopping mall.
1392 Grounds,
1393 /// If set, the enum was initialized with an unknown value.
1394 ///
1395 /// Applications can examine the value using [StructureType::value] or
1396 /// [StructureType::name].
1397 UnknownValue(structure_type::UnknownValue),
1398 }
1399
1400 #[doc(hidden)]
1401 pub mod structure_type {
1402 #[allow(unused_imports)]
1403 use super::*;
1404 #[derive(Clone, Debug, PartialEq)]
1405 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1406 }
1407
1408 impl StructureType {
1409 /// Gets the enum value.
1410 ///
1411 /// Returns `None` if the enum contains an unknown value deserialized from
1412 /// the string representation of enums.
1413 pub fn value(&self) -> std::option::Option<i32> {
1414 match self {
1415 Self::Unspecified => std::option::Option::Some(0),
1416 Self::Point => std::option::Option::Some(1),
1417 Self::Section => std::option::Option::Some(2),
1418 Self::Building => std::option::Option::Some(3),
1419 Self::Grounds => std::option::Option::Some(4),
1420 Self::UnknownValue(u) => u.0.value(),
1421 }
1422 }
1423
1424 /// Gets the enum value as a string.
1425 ///
1426 /// Returns `None` if the enum contains an unknown value deserialized from
1427 /// the integer representation of enums.
1428 pub fn name(&self) -> std::option::Option<&str> {
1429 match self {
1430 Self::Unspecified => std::option::Option::Some("STRUCTURE_TYPE_UNSPECIFIED"),
1431 Self::Point => std::option::Option::Some("POINT"),
1432 Self::Section => std::option::Option::Some("SECTION"),
1433 Self::Building => std::option::Option::Some("BUILDING"),
1434 Self::Grounds => std::option::Option::Some("GROUNDS"),
1435 Self::UnknownValue(u) => u.0.name(),
1436 }
1437 }
1438 }
1439
1440 impl std::default::Default for StructureType {
1441 fn default() -> Self {
1442 use std::convert::From;
1443 Self::from(0)
1444 }
1445 }
1446
1447 impl std::fmt::Display for StructureType {
1448 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1449 wkt::internal::display_enum(f, self.name(), self.value())
1450 }
1451 }
1452
1453 impl std::convert::From<i32> for StructureType {
1454 fn from(value: i32) -> Self {
1455 match value {
1456 0 => Self::Unspecified,
1457 1 => Self::Point,
1458 2 => Self::Section,
1459 3 => Self::Building,
1460 4 => Self::Grounds,
1461 _ => Self::UnknownValue(structure_type::UnknownValue(
1462 wkt::internal::UnknownEnumValue::Integer(value),
1463 )),
1464 }
1465 }
1466 }
1467
1468 impl std::convert::From<&str> for StructureType {
1469 fn from(value: &str) -> Self {
1470 use std::string::ToString;
1471 match value {
1472 "STRUCTURE_TYPE_UNSPECIFIED" => Self::Unspecified,
1473 "POINT" => Self::Point,
1474 "SECTION" => Self::Section,
1475 "BUILDING" => Self::Building,
1476 "GROUNDS" => Self::Grounds,
1477 _ => Self::UnknownValue(structure_type::UnknownValue(
1478 wkt::internal::UnknownEnumValue::String(value.to_string()),
1479 )),
1480 }
1481 }
1482 }
1483
1484 impl serde::ser::Serialize for StructureType {
1485 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1486 where
1487 S: serde::Serializer,
1488 {
1489 match self {
1490 Self::Unspecified => serializer.serialize_i32(0),
1491 Self::Point => serializer.serialize_i32(1),
1492 Self::Section => serializer.serialize_i32(2),
1493 Self::Building => serializer.serialize_i32(3),
1494 Self::Grounds => serializer.serialize_i32(4),
1495 Self::UnknownValue(u) => u.0.serialize(serializer),
1496 }
1497 }
1498 }
1499
1500 impl<'de> serde::de::Deserialize<'de> for StructureType {
1501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1502 where
1503 D: serde::Deserializer<'de>,
1504 {
1505 deserializer.deserialize_any(wkt::internal::EnumVisitor::<StructureType>::new(
1506 ".google.maps.geocode.v4.PlaceView.StructureType",
1507 ))
1508 }
1509 }
1510}
1511
1512/// An entrance is a single latitude/longitude coordinate pair that defines the
1513/// location of an entry and exit point for a place.
1514#[derive(Clone, Default, PartialEq)]
1515#[non_exhaustive]
1516pub struct Entrance {
1517 /// The location of the entrance.
1518 pub location: std::option::Option<google_cloud_type::model::LatLng>,
1519
1520 /// A list of tags that describe the entrance.
1521 pub tags: std::vec::Vec<crate::model::entrance::Tag>,
1522
1523 /// The structure this entrance is physically located on, in
1524 /// `places/{place_id}` format.
1525 pub place: std::string::String,
1526
1527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1528}
1529
1530impl Entrance {
1531 /// Creates a new default instance.
1532 pub fn new() -> Self {
1533 std::default::Default::default()
1534 }
1535
1536 /// Sets the value of [location][crate::model::Entrance::location].
1537 ///
1538 /// # Example
1539 /// ```ignore,no_run
1540 /// # use google_maps_geocode_v4::model::Entrance;
1541 /// use google_cloud_type::model::LatLng;
1542 /// let x = Entrance::new().set_location(LatLng::default()/* use setters */);
1543 /// ```
1544 pub fn set_location<T>(mut self, v: T) -> Self
1545 where
1546 T: std::convert::Into<google_cloud_type::model::LatLng>,
1547 {
1548 self.location = std::option::Option::Some(v.into());
1549 self
1550 }
1551
1552 /// Sets or clears the value of [location][crate::model::Entrance::location].
1553 ///
1554 /// # Example
1555 /// ```ignore,no_run
1556 /// # use google_maps_geocode_v4::model::Entrance;
1557 /// use google_cloud_type::model::LatLng;
1558 /// let x = Entrance::new().set_or_clear_location(Some(LatLng::default()/* use setters */));
1559 /// let x = Entrance::new().set_or_clear_location(None::<LatLng>);
1560 /// ```
1561 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
1562 where
1563 T: std::convert::Into<google_cloud_type::model::LatLng>,
1564 {
1565 self.location = v.map(|x| x.into());
1566 self
1567 }
1568
1569 /// Sets the value of [tags][crate::model::Entrance::tags].
1570 ///
1571 /// # Example
1572 /// ```ignore,no_run
1573 /// # use google_maps_geocode_v4::model::Entrance;
1574 /// use google_maps_geocode_v4::model::entrance::Tag;
1575 /// let x = Entrance::new().set_tags([
1576 /// Tag::Preferred,
1577 /// ]);
1578 /// ```
1579 pub fn set_tags<T, V>(mut self, v: T) -> Self
1580 where
1581 T: std::iter::IntoIterator<Item = V>,
1582 V: std::convert::Into<crate::model::entrance::Tag>,
1583 {
1584 use std::iter::Iterator;
1585 self.tags = v.into_iter().map(|i| i.into()).collect();
1586 self
1587 }
1588
1589 /// Sets the value of [place][crate::model::Entrance::place].
1590 ///
1591 /// # Example
1592 /// ```ignore,no_run
1593 /// # use google_maps_geocode_v4::model::Entrance;
1594 /// let x = Entrance::new().set_place("example");
1595 /// ```
1596 pub fn set_place<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1597 self.place = v.into();
1598 self
1599 }
1600}
1601
1602impl wkt::message::Message for Entrance {
1603 fn typename() -> &'static str {
1604 "type.googleapis.com/google.maps.geocode.v4.Entrance"
1605 }
1606}
1607
1608/// Defines additional types related to [Entrance].
1609pub mod entrance {
1610 #[allow(unused_imports)]
1611 use super::*;
1612
1613 /// Characteristics that describe an entrance.
1614 ///
1615 /// # Working with unknown values
1616 ///
1617 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1618 /// additional enum variants at any time. Adding new variants is not considered
1619 /// a breaking change. Applications should write their code in anticipation of:
1620 ///
1621 /// - New values appearing in future releases of the client library, **and**
1622 /// - New values received dynamically, without application changes.
1623 ///
1624 /// Please consult the [Working with enums] section in the user guide for some
1625 /// guidelines.
1626 ///
1627 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1628 #[derive(Clone, Debug, PartialEq)]
1629 #[non_exhaustive]
1630 pub enum Tag {
1631 /// Not used.
1632 Unspecified,
1633 /// The entrance likely provides physical access to the primary place in
1634 /// the returned destination. A place can have multiple preferred entrances.
1635 /// If an entrance does not have this tag, it means the entrance is
1636 /// physically on the same building as the primary place, but does not
1637 /// necessarily provide access to the place.
1638 ///
1639 /// For example, if the primary place is a restaurant in a strip mall, the
1640 /// "PREFERRED" entrances will be the ones that likely lead into the
1641 /// restaurant itself, while the other returned entrances will be other
1642 /// entrances for the building, such as entrances into other restaurants in
1643 /// the strip mall.
1644 ///
1645 /// If the primary place is a building itself, the `PREFERRED` entrances
1646 /// will be the ones that lead into the "main" part of the building. For
1647 /// example, in a shopping center the `PREFERRED` entrances will be the ones
1648 /// that allow access to the main foyer area, but if an entrance only
1649 /// provides access to a store on the side of the building, it won't be a
1650 /// `PREFERRED` entrance.
1651 ///
1652 /// Note: a `PREFERRED` entrance might not provide access to the primary
1653 /// place, and a non-`PREFERRED` entrance might provide access to the
1654 /// primary place.
1655 Preferred,
1656 /// If set, the enum was initialized with an unknown value.
1657 ///
1658 /// Applications can examine the value using [Tag::value] or
1659 /// [Tag::name].
1660 UnknownValue(tag::UnknownValue),
1661 }
1662
1663 #[doc(hidden)]
1664 pub mod tag {
1665 #[allow(unused_imports)]
1666 use super::*;
1667 #[derive(Clone, Debug, PartialEq)]
1668 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1669 }
1670
1671 impl Tag {
1672 /// Gets the enum value.
1673 ///
1674 /// Returns `None` if the enum contains an unknown value deserialized from
1675 /// the string representation of enums.
1676 pub fn value(&self) -> std::option::Option<i32> {
1677 match self {
1678 Self::Unspecified => std::option::Option::Some(0),
1679 Self::Preferred => std::option::Option::Some(1),
1680 Self::UnknownValue(u) => u.0.value(),
1681 }
1682 }
1683
1684 /// Gets the enum value as a string.
1685 ///
1686 /// Returns `None` if the enum contains an unknown value deserialized from
1687 /// the integer representation of enums.
1688 pub fn name(&self) -> std::option::Option<&str> {
1689 match self {
1690 Self::Unspecified => std::option::Option::Some("TAG_UNSPECIFIED"),
1691 Self::Preferred => std::option::Option::Some("PREFERRED"),
1692 Self::UnknownValue(u) => u.0.name(),
1693 }
1694 }
1695 }
1696
1697 impl std::default::Default for Tag {
1698 fn default() -> Self {
1699 use std::convert::From;
1700 Self::from(0)
1701 }
1702 }
1703
1704 impl std::fmt::Display for Tag {
1705 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1706 wkt::internal::display_enum(f, self.name(), self.value())
1707 }
1708 }
1709
1710 impl std::convert::From<i32> for Tag {
1711 fn from(value: i32) -> Self {
1712 match value {
1713 0 => Self::Unspecified,
1714 1 => Self::Preferred,
1715 _ => Self::UnknownValue(tag::UnknownValue(
1716 wkt::internal::UnknownEnumValue::Integer(value),
1717 )),
1718 }
1719 }
1720 }
1721
1722 impl std::convert::From<&str> for Tag {
1723 fn from(value: &str) -> Self {
1724 use std::string::ToString;
1725 match value {
1726 "TAG_UNSPECIFIED" => Self::Unspecified,
1727 "PREFERRED" => Self::Preferred,
1728 _ => Self::UnknownValue(tag::UnknownValue(
1729 wkt::internal::UnknownEnumValue::String(value.to_string()),
1730 )),
1731 }
1732 }
1733 }
1734
1735 impl serde::ser::Serialize for Tag {
1736 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1737 where
1738 S: serde::Serializer,
1739 {
1740 match self {
1741 Self::Unspecified => serializer.serialize_i32(0),
1742 Self::Preferred => serializer.serialize_i32(1),
1743 Self::UnknownValue(u) => u.0.serialize(serializer),
1744 }
1745 }
1746 }
1747
1748 impl<'de> serde::de::Deserialize<'de> for Tag {
1749 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1750 where
1751 D: serde::Deserializer<'de>,
1752 {
1753 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Tag>::new(
1754 ".google.maps.geocode.v4.Entrance.Tag",
1755 ))
1756 }
1757 }
1758}
1759
1760/// A navigation point is a location next to a road where navigation can end.
1761#[derive(Clone, Default, PartialEq)]
1762#[non_exhaustive]
1763pub struct NavigationPoint {
1764 /// Output only. A token that can be used to identify this navigation point.
1765 pub navigation_point_token: std::string::String,
1766
1767 /// The display name of this navigation point. For example, "5th Ave" or "Gate
1768 /// B".
1769 pub display_name: std::option::Option<google_cloud_type::model::LocalizedText>,
1770
1771 /// A point next to the road segment where navigation should end. The point is
1772 /// intentionally slightly offset from the road's centerline to clearly mark
1773 /// the side of the road where the place is located.
1774 pub location: std::option::Option<google_cloud_type::model::LatLng>,
1775
1776 /// Travel modes that are appropriate for this navigation point.
1777 pub travel_modes: std::vec::Vec<crate::model::navigation_point::TravelMode>,
1778
1779 /// Lists `usages` supported by this navigation point. If empty, it does not
1780 /// necessarily mean its usage is restricted in any way. All navigation
1781 /// points can be used for general navigation.
1782 pub usages: std::vec::Vec<crate::model::navigation_point::Usage>,
1783
1784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1785}
1786
1787impl NavigationPoint {
1788 /// Creates a new default instance.
1789 pub fn new() -> Self {
1790 std::default::Default::default()
1791 }
1792
1793 /// Sets the value of [navigation_point_token][crate::model::NavigationPoint::navigation_point_token].
1794 ///
1795 /// # Example
1796 /// ```ignore,no_run
1797 /// # use google_maps_geocode_v4::model::NavigationPoint;
1798 /// let x = NavigationPoint::new().set_navigation_point_token("example");
1799 /// ```
1800 pub fn set_navigation_point_token<T: std::convert::Into<std::string::String>>(
1801 mut self,
1802 v: T,
1803 ) -> Self {
1804 self.navigation_point_token = v.into();
1805 self
1806 }
1807
1808 /// Sets the value of [display_name][crate::model::NavigationPoint::display_name].
1809 ///
1810 /// # Example
1811 /// ```ignore,no_run
1812 /// # use google_maps_geocode_v4::model::NavigationPoint;
1813 /// use google_cloud_type::model::LocalizedText;
1814 /// let x = NavigationPoint::new().set_display_name(LocalizedText::default()/* use setters */);
1815 /// ```
1816 pub fn set_display_name<T>(mut self, v: T) -> Self
1817 where
1818 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
1819 {
1820 self.display_name = std::option::Option::Some(v.into());
1821 self
1822 }
1823
1824 /// Sets or clears the value of [display_name][crate::model::NavigationPoint::display_name].
1825 ///
1826 /// # Example
1827 /// ```ignore,no_run
1828 /// # use google_maps_geocode_v4::model::NavigationPoint;
1829 /// use google_cloud_type::model::LocalizedText;
1830 /// let x = NavigationPoint::new().set_or_clear_display_name(Some(LocalizedText::default()/* use setters */));
1831 /// let x = NavigationPoint::new().set_or_clear_display_name(None::<LocalizedText>);
1832 /// ```
1833 pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
1834 where
1835 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
1836 {
1837 self.display_name = v.map(|x| x.into());
1838 self
1839 }
1840
1841 /// Sets the value of [location][crate::model::NavigationPoint::location].
1842 ///
1843 /// # Example
1844 /// ```ignore,no_run
1845 /// # use google_maps_geocode_v4::model::NavigationPoint;
1846 /// use google_cloud_type::model::LatLng;
1847 /// let x = NavigationPoint::new().set_location(LatLng::default()/* use setters */);
1848 /// ```
1849 pub fn set_location<T>(mut self, v: T) -> Self
1850 where
1851 T: std::convert::Into<google_cloud_type::model::LatLng>,
1852 {
1853 self.location = std::option::Option::Some(v.into());
1854 self
1855 }
1856
1857 /// Sets or clears the value of [location][crate::model::NavigationPoint::location].
1858 ///
1859 /// # Example
1860 /// ```ignore,no_run
1861 /// # use google_maps_geocode_v4::model::NavigationPoint;
1862 /// use google_cloud_type::model::LatLng;
1863 /// let x = NavigationPoint::new().set_or_clear_location(Some(LatLng::default()/* use setters */));
1864 /// let x = NavigationPoint::new().set_or_clear_location(None::<LatLng>);
1865 /// ```
1866 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
1867 where
1868 T: std::convert::Into<google_cloud_type::model::LatLng>,
1869 {
1870 self.location = v.map(|x| x.into());
1871 self
1872 }
1873
1874 /// Sets the value of [travel_modes][crate::model::NavigationPoint::travel_modes].
1875 ///
1876 /// # Example
1877 /// ```ignore,no_run
1878 /// # use google_maps_geocode_v4::model::NavigationPoint;
1879 /// use google_maps_geocode_v4::model::navigation_point::TravelMode;
1880 /// let x = NavigationPoint::new().set_travel_modes([
1881 /// TravelMode::Drive,
1882 /// TravelMode::Walk,
1883 /// ]);
1884 /// ```
1885 pub fn set_travel_modes<T, V>(mut self, v: T) -> Self
1886 where
1887 T: std::iter::IntoIterator<Item = V>,
1888 V: std::convert::Into<crate::model::navigation_point::TravelMode>,
1889 {
1890 use std::iter::Iterator;
1891 self.travel_modes = v.into_iter().map(|i| i.into()).collect();
1892 self
1893 }
1894
1895 /// Sets the value of [usages][crate::model::NavigationPoint::usages].
1896 ///
1897 /// # Example
1898 /// ```ignore,no_run
1899 /// # use google_maps_geocode_v4::model::NavigationPoint;
1900 /// use google_maps_geocode_v4::model::navigation_point::Usage;
1901 /// let x = NavigationPoint::new().set_usages([
1902 /// Usage::Unknown,
1903 /// Usage::Dropoff,
1904 /// Usage::Pickup,
1905 /// ]);
1906 /// ```
1907 pub fn set_usages<T, V>(mut self, v: T) -> Self
1908 where
1909 T: std::iter::IntoIterator<Item = V>,
1910 V: std::convert::Into<crate::model::navigation_point::Usage>,
1911 {
1912 use std::iter::Iterator;
1913 self.usages = v.into_iter().map(|i| i.into()).collect();
1914 self
1915 }
1916}
1917
1918impl wkt::message::Message for NavigationPoint {
1919 fn typename() -> &'static str {
1920 "type.googleapis.com/google.maps.geocode.v4.NavigationPoint"
1921 }
1922}
1923
1924/// Defines additional types related to [NavigationPoint].
1925pub mod navigation_point {
1926 #[allow(unused_imports)]
1927 use super::*;
1928
1929 /// Travel modes that are appropriate for this navigation point.
1930 ///
1931 /// # Working with unknown values
1932 ///
1933 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1934 /// additional enum variants at any time. Adding new variants is not considered
1935 /// a breaking change. Applications should write their code in anticipation of:
1936 ///
1937 /// - New values appearing in future releases of the client library, **and**
1938 /// - New values received dynamically, without application changes.
1939 ///
1940 /// Please consult the [Working with enums] section in the user guide for some
1941 /// guidelines.
1942 ///
1943 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1944 #[derive(Clone, Debug, PartialEq)]
1945 #[non_exhaustive]
1946 pub enum TravelMode {
1947 /// Not used.
1948 Unspecified,
1949 /// Suitable for driving.
1950 Drive,
1951 /// Suitable for walking.
1952 Walk,
1953 /// If set, the enum was initialized with an unknown value.
1954 ///
1955 /// Applications can examine the value using [TravelMode::value] or
1956 /// [TravelMode::name].
1957 UnknownValue(travel_mode::UnknownValue),
1958 }
1959
1960 #[doc(hidden)]
1961 pub mod travel_mode {
1962 #[allow(unused_imports)]
1963 use super::*;
1964 #[derive(Clone, Debug, PartialEq)]
1965 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1966 }
1967
1968 impl TravelMode {
1969 /// Gets the enum value.
1970 ///
1971 /// Returns `None` if the enum contains an unknown value deserialized from
1972 /// the string representation of enums.
1973 pub fn value(&self) -> std::option::Option<i32> {
1974 match self {
1975 Self::Unspecified => std::option::Option::Some(0),
1976 Self::Drive => std::option::Option::Some(1),
1977 Self::Walk => std::option::Option::Some(2),
1978 Self::UnknownValue(u) => u.0.value(),
1979 }
1980 }
1981
1982 /// Gets the enum value as a string.
1983 ///
1984 /// Returns `None` if the enum contains an unknown value deserialized from
1985 /// the integer representation of enums.
1986 pub fn name(&self) -> std::option::Option<&str> {
1987 match self {
1988 Self::Unspecified => std::option::Option::Some("TRAVEL_MODE_UNSPECIFIED"),
1989 Self::Drive => std::option::Option::Some("DRIVE"),
1990 Self::Walk => std::option::Option::Some("WALK"),
1991 Self::UnknownValue(u) => u.0.name(),
1992 }
1993 }
1994 }
1995
1996 impl std::default::Default for TravelMode {
1997 fn default() -> Self {
1998 use std::convert::From;
1999 Self::from(0)
2000 }
2001 }
2002
2003 impl std::fmt::Display for TravelMode {
2004 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2005 wkt::internal::display_enum(f, self.name(), self.value())
2006 }
2007 }
2008
2009 impl std::convert::From<i32> for TravelMode {
2010 fn from(value: i32) -> Self {
2011 match value {
2012 0 => Self::Unspecified,
2013 1 => Self::Drive,
2014 2 => Self::Walk,
2015 _ => Self::UnknownValue(travel_mode::UnknownValue(
2016 wkt::internal::UnknownEnumValue::Integer(value),
2017 )),
2018 }
2019 }
2020 }
2021
2022 impl std::convert::From<&str> for TravelMode {
2023 fn from(value: &str) -> Self {
2024 use std::string::ToString;
2025 match value {
2026 "TRAVEL_MODE_UNSPECIFIED" => Self::Unspecified,
2027 "DRIVE" => Self::Drive,
2028 "WALK" => Self::Walk,
2029 _ => Self::UnknownValue(travel_mode::UnknownValue(
2030 wkt::internal::UnknownEnumValue::String(value.to_string()),
2031 )),
2032 }
2033 }
2034 }
2035
2036 impl serde::ser::Serialize for TravelMode {
2037 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2038 where
2039 S: serde::Serializer,
2040 {
2041 match self {
2042 Self::Unspecified => serializer.serialize_i32(0),
2043 Self::Drive => serializer.serialize_i32(1),
2044 Self::Walk => serializer.serialize_i32(2),
2045 Self::UnknownValue(u) => u.0.serialize(serializer),
2046 }
2047 }
2048 }
2049
2050 impl<'de> serde::de::Deserialize<'de> for TravelMode {
2051 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2052 where
2053 D: serde::Deserializer<'de>,
2054 {
2055 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TravelMode>::new(
2056 ".google.maps.geocode.v4.NavigationPoint.TravelMode",
2057 ))
2058 }
2059 }
2060
2061 /// Usages supported by this navigation point.
2062 /// New values may be added in the future.
2063 ///
2064 /// # Working with unknown values
2065 ///
2066 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2067 /// additional enum variants at any time. Adding new variants is not considered
2068 /// a breaking change. Applications should write their code in anticipation of:
2069 ///
2070 /// - New values appearing in future releases of the client library, **and**
2071 /// - New values received dynamically, without application changes.
2072 ///
2073 /// Please consult the [Working with enums] section in the user guide for some
2074 /// guidelines.
2075 ///
2076 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2077 #[derive(Clone, Debug, PartialEq)]
2078 #[non_exhaustive]
2079 pub enum Usage {
2080 /// Not used.
2081 Unspecified,
2082 /// Indicates that the usage type is unknown.
2083 Unknown,
2084 /// Suitable for dropping off a passenger. For example, a rideshare drop off
2085 /// location.
2086 Dropoff,
2087 /// Suitable for picking up a passenger. For example, a rideshare pick up
2088 /// location.
2089 Pickup,
2090 /// Suitable for parking. For example, within a parking lot.
2091 Parking,
2092 /// If set, the enum was initialized with an unknown value.
2093 ///
2094 /// Applications can examine the value using [Usage::value] or
2095 /// [Usage::name].
2096 UnknownValue(usage::UnknownValue),
2097 }
2098
2099 #[doc(hidden)]
2100 pub mod usage {
2101 #[allow(unused_imports)]
2102 use super::*;
2103 #[derive(Clone, Debug, PartialEq)]
2104 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2105 }
2106
2107 impl Usage {
2108 /// Gets the enum value.
2109 ///
2110 /// Returns `None` if the enum contains an unknown value deserialized from
2111 /// the string representation of enums.
2112 pub fn value(&self) -> std::option::Option<i32> {
2113 match self {
2114 Self::Unspecified => std::option::Option::Some(0),
2115 Self::Unknown => std::option::Option::Some(1),
2116 Self::Dropoff => std::option::Option::Some(2),
2117 Self::Pickup => std::option::Option::Some(3),
2118 Self::Parking => std::option::Option::Some(4),
2119 Self::UnknownValue(u) => u.0.value(),
2120 }
2121 }
2122
2123 /// Gets the enum value as a string.
2124 ///
2125 /// Returns `None` if the enum contains an unknown value deserialized from
2126 /// the integer representation of enums.
2127 pub fn name(&self) -> std::option::Option<&str> {
2128 match self {
2129 Self::Unspecified => std::option::Option::Some("USAGE_UNSPECIFIED"),
2130 Self::Unknown => std::option::Option::Some("UNKNOWN"),
2131 Self::Dropoff => std::option::Option::Some("DROPOFF"),
2132 Self::Pickup => std::option::Option::Some("PICKUP"),
2133 Self::Parking => std::option::Option::Some("PARKING"),
2134 Self::UnknownValue(u) => u.0.name(),
2135 }
2136 }
2137 }
2138
2139 impl std::default::Default for Usage {
2140 fn default() -> Self {
2141 use std::convert::From;
2142 Self::from(0)
2143 }
2144 }
2145
2146 impl std::fmt::Display for Usage {
2147 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2148 wkt::internal::display_enum(f, self.name(), self.value())
2149 }
2150 }
2151
2152 impl std::convert::From<i32> for Usage {
2153 fn from(value: i32) -> Self {
2154 match value {
2155 0 => Self::Unspecified,
2156 1 => Self::Unknown,
2157 2 => Self::Dropoff,
2158 3 => Self::Pickup,
2159 4 => Self::Parking,
2160 _ => Self::UnknownValue(usage::UnknownValue(
2161 wkt::internal::UnknownEnumValue::Integer(value),
2162 )),
2163 }
2164 }
2165 }
2166
2167 impl std::convert::From<&str> for Usage {
2168 fn from(value: &str) -> Self {
2169 use std::string::ToString;
2170 match value {
2171 "USAGE_UNSPECIFIED" => Self::Unspecified,
2172 "UNKNOWN" => Self::Unknown,
2173 "DROPOFF" => Self::Dropoff,
2174 "PICKUP" => Self::Pickup,
2175 "PARKING" => Self::Parking,
2176 _ => Self::UnknownValue(usage::UnknownValue(
2177 wkt::internal::UnknownEnumValue::String(value.to_string()),
2178 )),
2179 }
2180 }
2181 }
2182
2183 impl serde::ser::Serialize for Usage {
2184 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2185 where
2186 S: serde::Serializer,
2187 {
2188 match self {
2189 Self::Unspecified => serializer.serialize_i32(0),
2190 Self::Unknown => serializer.serialize_i32(1),
2191 Self::Dropoff => serializer.serialize_i32(2),
2192 Self::Pickup => serializer.serialize_i32(3),
2193 Self::Parking => serializer.serialize_i32(4),
2194 Self::UnknownValue(u) => u.0.serialize(serializer),
2195 }
2196 }
2197 }
2198
2199 impl<'de> serde::de::Deserialize<'de> for Usage {
2200 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2201 where
2202 D: serde::Deserializer<'de>,
2203 {
2204 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Usage>::new(
2205 ".google.maps.geocode.v4.NavigationPoint.Usage",
2206 ))
2207 }
2208 }
2209}
2210
2211/// Landmarks are used to communicate where the destination is or help with
2212/// arriving at the destination.
2213#[derive(Clone, Default, PartialEq)]
2214#[non_exhaustive]
2215pub struct Landmark {
2216 /// A human-readable description of how the destination relates to the
2217 /// landmark. For example: "Near the Empire State Building" or "Across from
2218 /// the White House".
2219 pub relational_description: std::option::Option<google_cloud_type::model::LocalizedText>,
2220
2221 /// Tags that describe how the landmark can be used in the context of the
2222 /// destination.
2223 pub tags: std::vec::Vec<crate::model::landmark::Tag>,
2224
2225 /// Output only. The straight-line distance from this landmark to the
2226 /// destination in meters.
2227 pub straight_line_distance_meters: f64,
2228
2229 /// Output only. The road-network distance from this landmark to the
2230 /// destination in meters.
2231 pub travel_distance_meters: f64,
2232
2233 /// The landmark.
2234 pub landmark: std::option::Option<crate::model::landmark::Landmark>,
2235
2236 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2237}
2238
2239impl Landmark {
2240 /// Creates a new default instance.
2241 pub fn new() -> Self {
2242 std::default::Default::default()
2243 }
2244
2245 /// Sets the value of [relational_description][crate::model::Landmark::relational_description].
2246 ///
2247 /// # Example
2248 /// ```ignore,no_run
2249 /// # use google_maps_geocode_v4::model::Landmark;
2250 /// use google_cloud_type::model::LocalizedText;
2251 /// let x = Landmark::new().set_relational_description(LocalizedText::default()/* use setters */);
2252 /// ```
2253 pub fn set_relational_description<T>(mut self, v: T) -> Self
2254 where
2255 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
2256 {
2257 self.relational_description = std::option::Option::Some(v.into());
2258 self
2259 }
2260
2261 /// Sets or clears the value of [relational_description][crate::model::Landmark::relational_description].
2262 ///
2263 /// # Example
2264 /// ```ignore,no_run
2265 /// # use google_maps_geocode_v4::model::Landmark;
2266 /// use google_cloud_type::model::LocalizedText;
2267 /// let x = Landmark::new().set_or_clear_relational_description(Some(LocalizedText::default()/* use setters */));
2268 /// let x = Landmark::new().set_or_clear_relational_description(None::<LocalizedText>);
2269 /// ```
2270 pub fn set_or_clear_relational_description<T>(mut self, v: std::option::Option<T>) -> Self
2271 where
2272 T: std::convert::Into<google_cloud_type::model::LocalizedText>,
2273 {
2274 self.relational_description = v.map(|x| x.into());
2275 self
2276 }
2277
2278 /// Sets the value of [tags][crate::model::Landmark::tags].
2279 ///
2280 /// # Example
2281 /// ```ignore,no_run
2282 /// # use google_maps_geocode_v4::model::Landmark;
2283 /// use google_maps_geocode_v4::model::landmark::Tag;
2284 /// let x = Landmark::new().set_tags([
2285 /// Tag::Address,
2286 /// Tag::Arrival,
2287 /// ]);
2288 /// ```
2289 pub fn set_tags<T, V>(mut self, v: T) -> Self
2290 where
2291 T: std::iter::IntoIterator<Item = V>,
2292 V: std::convert::Into<crate::model::landmark::Tag>,
2293 {
2294 use std::iter::Iterator;
2295 self.tags = v.into_iter().map(|i| i.into()).collect();
2296 self
2297 }
2298
2299 /// Sets the value of [straight_line_distance_meters][crate::model::Landmark::straight_line_distance_meters].
2300 ///
2301 /// # Example
2302 /// ```ignore,no_run
2303 /// # use google_maps_geocode_v4::model::Landmark;
2304 /// let x = Landmark::new().set_straight_line_distance_meters(42.0);
2305 /// ```
2306 pub fn set_straight_line_distance_meters<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2307 self.straight_line_distance_meters = v.into();
2308 self
2309 }
2310
2311 /// Sets the value of [travel_distance_meters][crate::model::Landmark::travel_distance_meters].
2312 ///
2313 /// # Example
2314 /// ```ignore,no_run
2315 /// # use google_maps_geocode_v4::model::Landmark;
2316 /// let x = Landmark::new().set_travel_distance_meters(42.0);
2317 /// ```
2318 pub fn set_travel_distance_meters<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2319 self.travel_distance_meters = v.into();
2320 self
2321 }
2322
2323 /// Sets the value of [landmark][crate::model::Landmark::landmark].
2324 ///
2325 /// Note that all the setters affecting `landmark` are mutually
2326 /// exclusive.
2327 ///
2328 /// # Example
2329 /// ```ignore,no_run
2330 /// # use google_maps_geocode_v4::model::Landmark;
2331 /// use google_maps_geocode_v4::model::PlaceView;
2332 /// let x = Landmark::new().set_landmark(Some(
2333 /// google_maps_geocode_v4::model::landmark::Landmark::Place(PlaceView::default().into())));
2334 /// ```
2335 pub fn set_landmark<
2336 T: std::convert::Into<std::option::Option<crate::model::landmark::Landmark>>,
2337 >(
2338 mut self,
2339 v: T,
2340 ) -> Self {
2341 self.landmark = v.into();
2342 self
2343 }
2344
2345 /// The value of [landmark][crate::model::Landmark::landmark]
2346 /// if it holds a `Place`, `None` if the field is not set or
2347 /// holds a different branch.
2348 pub fn place(&self) -> std::option::Option<&std::boxed::Box<crate::model::PlaceView>> {
2349 #[allow(unreachable_patterns)]
2350 self.landmark.as_ref().and_then(|v| match v {
2351 crate::model::landmark::Landmark::Place(v) => std::option::Option::Some(v),
2352 _ => std::option::Option::None,
2353 })
2354 }
2355
2356 /// Sets the value of [landmark][crate::model::Landmark::landmark]
2357 /// to hold a `Place`.
2358 ///
2359 /// Note that all the setters affecting `landmark` are
2360 /// mutually exclusive.
2361 ///
2362 /// # Example
2363 /// ```ignore,no_run
2364 /// # use google_maps_geocode_v4::model::Landmark;
2365 /// use google_maps_geocode_v4::model::PlaceView;
2366 /// let x = Landmark::new().set_place(PlaceView::default()/* use setters */);
2367 /// assert!(x.place().is_some());
2368 /// ```
2369 pub fn set_place<T: std::convert::Into<std::boxed::Box<crate::model::PlaceView>>>(
2370 mut self,
2371 v: T,
2372 ) -> Self {
2373 self.landmark =
2374 std::option::Option::Some(crate::model::landmark::Landmark::Place(v.into()));
2375 self
2376 }
2377}
2378
2379impl wkt::message::Message for Landmark {
2380 fn typename() -> &'static str {
2381 "type.googleapis.com/google.maps.geocode.v4.Landmark"
2382 }
2383}
2384
2385/// Defines additional types related to [Landmark].
2386pub mod landmark {
2387 #[allow(unused_imports)]
2388 use super::*;
2389
2390 /// The list of all possible tags that describe how a landmark can be used in
2391 /// the context of a destination.
2392 ///
2393 /// If an address has both the `ADDRESS` and `ARRIVAL` tags, it means the
2394 /// landmark is both locally prominent and close to the destination.
2395 ///
2396 /// # Working with unknown values
2397 ///
2398 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2399 /// additional enum variants at any time. Adding new variants is not considered
2400 /// a breaking change. Applications should write their code in anticipation of:
2401 ///
2402 /// - New values appearing in future releases of the client library, **and**
2403 /// - New values received dynamically, without application changes.
2404 ///
2405 /// Please consult the [Working with enums] section in the user guide for some
2406 /// guidelines.
2407 ///
2408 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2409 #[derive(Clone, Debug, PartialEq)]
2410 #[non_exhaustive]
2411 pub enum Tag {
2412 /// Not used.
2413 Unspecified,
2414 /// A locally prominent place that can be used to identify the general
2415 /// location of the destination. Typically within a few hundred meters of the
2416 /// destination. These are similar to the landmarks returned by the
2417 /// Address Descriptors feature of the Geocoding API:
2418 /// <https://developers.google.com/maps/documentation/geocoding/address-descriptors/requests-address-descriptors>.
2419 Address,
2420 /// A place that can be used to help arrive at the destination. Useful for
2421 /// navigation once you are close to the destination. For example, this
2422 /// landmark might be a place that is across the street from the destination.
2423 /// A landmark with this tag is typically closer to the destination than
2424 /// landmarks with the `ADDRESS` tag.
2425 Arrival,
2426 /// If set, the enum was initialized with an unknown value.
2427 ///
2428 /// Applications can examine the value using [Tag::value] or
2429 /// [Tag::name].
2430 UnknownValue(tag::UnknownValue),
2431 }
2432
2433 #[doc(hidden)]
2434 pub mod tag {
2435 #[allow(unused_imports)]
2436 use super::*;
2437 #[derive(Clone, Debug, PartialEq)]
2438 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2439 }
2440
2441 impl Tag {
2442 /// Gets the enum value.
2443 ///
2444 /// Returns `None` if the enum contains an unknown value deserialized from
2445 /// the string representation of enums.
2446 pub fn value(&self) -> std::option::Option<i32> {
2447 match self {
2448 Self::Unspecified => std::option::Option::Some(0),
2449 Self::Address => std::option::Option::Some(1),
2450 Self::Arrival => std::option::Option::Some(2),
2451 Self::UnknownValue(u) => u.0.value(),
2452 }
2453 }
2454
2455 /// Gets the enum value as a string.
2456 ///
2457 /// Returns `None` if the enum contains an unknown value deserialized from
2458 /// the integer representation of enums.
2459 pub fn name(&self) -> std::option::Option<&str> {
2460 match self {
2461 Self::Unspecified => std::option::Option::Some("TAG_UNSPECIFIED"),
2462 Self::Address => std::option::Option::Some("ADDRESS"),
2463 Self::Arrival => std::option::Option::Some("ARRIVAL"),
2464 Self::UnknownValue(u) => u.0.name(),
2465 }
2466 }
2467 }
2468
2469 impl std::default::Default for Tag {
2470 fn default() -> Self {
2471 use std::convert::From;
2472 Self::from(0)
2473 }
2474 }
2475
2476 impl std::fmt::Display for Tag {
2477 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2478 wkt::internal::display_enum(f, self.name(), self.value())
2479 }
2480 }
2481
2482 impl std::convert::From<i32> for Tag {
2483 fn from(value: i32) -> Self {
2484 match value {
2485 0 => Self::Unspecified,
2486 1 => Self::Address,
2487 2 => Self::Arrival,
2488 _ => Self::UnknownValue(tag::UnknownValue(
2489 wkt::internal::UnknownEnumValue::Integer(value),
2490 )),
2491 }
2492 }
2493 }
2494
2495 impl std::convert::From<&str> for Tag {
2496 fn from(value: &str) -> Self {
2497 use std::string::ToString;
2498 match value {
2499 "TAG_UNSPECIFIED" => Self::Unspecified,
2500 "ADDRESS" => Self::Address,
2501 "ARRIVAL" => Self::Arrival,
2502 _ => Self::UnknownValue(tag::UnknownValue(
2503 wkt::internal::UnknownEnumValue::String(value.to_string()),
2504 )),
2505 }
2506 }
2507 }
2508
2509 impl serde::ser::Serialize for Tag {
2510 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2511 where
2512 S: serde::Serializer,
2513 {
2514 match self {
2515 Self::Unspecified => serializer.serialize_i32(0),
2516 Self::Address => serializer.serialize_i32(1),
2517 Self::Arrival => serializer.serialize_i32(2),
2518 Self::UnknownValue(u) => u.0.serialize(serializer),
2519 }
2520 }
2521 }
2522
2523 impl<'de> serde::de::Deserialize<'de> for Tag {
2524 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2525 where
2526 D: serde::Deserializer<'de>,
2527 {
2528 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Tag>::new(
2529 ".google.maps.geocode.v4.Landmark.Tag",
2530 ))
2531 }
2532 }
2533
2534 /// The landmark.
2535 #[derive(Clone, Debug, PartialEq)]
2536 #[non_exhaustive]
2537 pub enum Landmark {
2538 /// The place that represents this landmark.
2539 Place(std::boxed::Box<crate::model::PlaceView>),
2540 }
2541}
2542
2543/// Request message for GeocodeService.GeocodeAddress.
2544#[derive(Clone, Default, PartialEq)]
2545#[non_exhaustive]
2546pub struct GeocodeAddressRequest {
2547 /// Optional. The region to search. This location serves as a bias which means
2548 /// results around the given location are preferred.
2549 pub location_bias: std::option::Option<crate::model::geocode_address_request::LocationBias>,
2550
2551 /// Optional. Language in which the results should be returned.
2552 pub language_code: std::string::String,
2553
2554 /// Optional. Region code. The region code, specified as a ccTLD ("top-level
2555 /// domain") two-character value. The parameter affects results based on
2556 /// applicable law. This parameter will also influence, but not fully restrict,
2557 /// results from the service.
2558 pub region_code: std::string::String,
2559
2560 /// The address to geocode.
2561 pub address_input: std::option::Option<crate::model::geocode_address_request::AddressInput>,
2562
2563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2564}
2565
2566impl GeocodeAddressRequest {
2567 /// Creates a new default instance.
2568 pub fn new() -> Self {
2569 std::default::Default::default()
2570 }
2571
2572 /// Sets the value of [location_bias][crate::model::GeocodeAddressRequest::location_bias].
2573 ///
2574 /// # Example
2575 /// ```ignore,no_run
2576 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2577 /// use google_maps_geocode_v4::model::geocode_address_request::LocationBias;
2578 /// let x = GeocodeAddressRequest::new().set_location_bias(LocationBias::default()/* use setters */);
2579 /// ```
2580 pub fn set_location_bias<T>(mut self, v: T) -> Self
2581 where
2582 T: std::convert::Into<crate::model::geocode_address_request::LocationBias>,
2583 {
2584 self.location_bias = std::option::Option::Some(v.into());
2585 self
2586 }
2587
2588 /// Sets or clears the value of [location_bias][crate::model::GeocodeAddressRequest::location_bias].
2589 ///
2590 /// # Example
2591 /// ```ignore,no_run
2592 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2593 /// use google_maps_geocode_v4::model::geocode_address_request::LocationBias;
2594 /// let x = GeocodeAddressRequest::new().set_or_clear_location_bias(Some(LocationBias::default()/* use setters */));
2595 /// let x = GeocodeAddressRequest::new().set_or_clear_location_bias(None::<LocationBias>);
2596 /// ```
2597 pub fn set_or_clear_location_bias<T>(mut self, v: std::option::Option<T>) -> Self
2598 where
2599 T: std::convert::Into<crate::model::geocode_address_request::LocationBias>,
2600 {
2601 self.location_bias = v.map(|x| x.into());
2602 self
2603 }
2604
2605 /// Sets the value of [language_code][crate::model::GeocodeAddressRequest::language_code].
2606 ///
2607 /// # Example
2608 /// ```ignore,no_run
2609 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2610 /// let x = GeocodeAddressRequest::new().set_language_code("example");
2611 /// ```
2612 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2613 self.language_code = v.into();
2614 self
2615 }
2616
2617 /// Sets the value of [region_code][crate::model::GeocodeAddressRequest::region_code].
2618 ///
2619 /// # Example
2620 /// ```ignore,no_run
2621 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2622 /// let x = GeocodeAddressRequest::new().set_region_code("example");
2623 /// ```
2624 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2625 self.region_code = v.into();
2626 self
2627 }
2628
2629 /// Sets the value of [address_input][crate::model::GeocodeAddressRequest::address_input].
2630 ///
2631 /// Note that all the setters affecting `address_input` are mutually
2632 /// exclusive.
2633 ///
2634 /// # Example
2635 /// ```ignore,no_run
2636 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2637 /// use google_maps_geocode_v4::model::geocode_address_request::AddressInput;
2638 /// let x = GeocodeAddressRequest::new().set_address_input(Some(AddressInput::AddressQuery("example".to_string())));
2639 /// ```
2640 pub fn set_address_input<
2641 T: std::convert::Into<
2642 std::option::Option<crate::model::geocode_address_request::AddressInput>,
2643 >,
2644 >(
2645 mut self,
2646 v: T,
2647 ) -> Self {
2648 self.address_input = v.into();
2649 self
2650 }
2651
2652 /// The value of [address_input][crate::model::GeocodeAddressRequest::address_input]
2653 /// if it holds a `AddressQuery`, `None` if the field is not set or
2654 /// holds a different branch.
2655 pub fn address_query(&self) -> std::option::Option<&std::string::String> {
2656 #[allow(unreachable_patterns)]
2657 self.address_input.as_ref().and_then(|v| match v {
2658 crate::model::geocode_address_request::AddressInput::AddressQuery(v) => {
2659 std::option::Option::Some(v)
2660 }
2661 _ => std::option::Option::None,
2662 })
2663 }
2664
2665 /// Sets the value of [address_input][crate::model::GeocodeAddressRequest::address_input]
2666 /// to hold a `AddressQuery`.
2667 ///
2668 /// Note that all the setters affecting `address_input` are
2669 /// mutually exclusive.
2670 ///
2671 /// # Example
2672 /// ```ignore,no_run
2673 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2674 /// let x = GeocodeAddressRequest::new().set_address_query("example");
2675 /// assert!(x.address_query().is_some());
2676 /// assert!(x.address().is_none());
2677 /// ```
2678 pub fn set_address_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2679 self.address_input = std::option::Option::Some(
2680 crate::model::geocode_address_request::AddressInput::AddressQuery(v.into()),
2681 );
2682 self
2683 }
2684
2685 /// The value of [address_input][crate::model::GeocodeAddressRequest::address_input]
2686 /// if it holds a `Address`, `None` if the field is not set or
2687 /// holds a different branch.
2688 pub fn address(
2689 &self,
2690 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>> {
2691 #[allow(unreachable_patterns)]
2692 self.address_input.as_ref().and_then(|v| match v {
2693 crate::model::geocode_address_request::AddressInput::Address(v) => {
2694 std::option::Option::Some(v)
2695 }
2696 _ => std::option::Option::None,
2697 })
2698 }
2699
2700 /// Sets the value of [address_input][crate::model::GeocodeAddressRequest::address_input]
2701 /// to hold a `Address`.
2702 ///
2703 /// Note that all the setters affecting `address_input` are
2704 /// mutually exclusive.
2705 ///
2706 /// # Example
2707 /// ```ignore,no_run
2708 /// # use google_maps_geocode_v4::model::GeocodeAddressRequest;
2709 /// use google_cloud_type::model::PostalAddress;
2710 /// let x = GeocodeAddressRequest::new().set_address(PostalAddress::default()/* use setters */);
2711 /// assert!(x.address().is_some());
2712 /// assert!(x.address_query().is_none());
2713 /// ```
2714 pub fn set_address<
2715 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
2716 >(
2717 mut self,
2718 v: T,
2719 ) -> Self {
2720 self.address_input = std::option::Option::Some(
2721 crate::model::geocode_address_request::AddressInput::Address(v.into()),
2722 );
2723 self
2724 }
2725}
2726
2727impl wkt::message::Message for GeocodeAddressRequest {
2728 fn typename() -> &'static str {
2729 "type.googleapis.com/google.maps.geocode.v4.GeocodeAddressRequest"
2730 }
2731}
2732
2733/// Defines additional types related to [GeocodeAddressRequest].
2734pub mod geocode_address_request {
2735 #[allow(unused_imports)]
2736 use super::*;
2737
2738 /// The region to search. This location serves as a bias which means results
2739 /// around the given location are preferred.
2740 #[derive(Clone, Default, PartialEq)]
2741 #[non_exhaustive]
2742 pub struct LocationBias {
2743 /// Types of location bias.
2744 pub r#type: std::option::Option<crate::model::geocode_address_request::location_bias::Type>,
2745
2746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2747 }
2748
2749 impl LocationBias {
2750 /// Creates a new default instance.
2751 pub fn new() -> Self {
2752 std::default::Default::default()
2753 }
2754
2755 /// Sets the value of [r#type][crate::model::geocode_address_request::LocationBias::type].
2756 ///
2757 /// Note that all the setters affecting `r#type` are mutually
2758 /// exclusive.
2759 ///
2760 /// # Example
2761 /// ```ignore,no_run
2762 /// # use google_maps_geocode_v4::model::geocode_address_request::LocationBias;
2763 /// use google_geo_type::model::Viewport;
2764 /// let x = LocationBias::new().set_type(Some(
2765 /// google_maps_geocode_v4::model::geocode_address_request::location_bias::Type::Rectangle(Viewport::default().into())));
2766 /// ```
2767 pub fn set_type<
2768 T: std::convert::Into<
2769 std::option::Option<crate::model::geocode_address_request::location_bias::Type>,
2770 >,
2771 >(
2772 mut self,
2773 v: T,
2774 ) -> Self {
2775 self.r#type = v.into();
2776 self
2777 }
2778
2779 /// The value of [r#type][crate::model::geocode_address_request::LocationBias::r#type]
2780 /// if it holds a `Rectangle`, `None` if the field is not set or
2781 /// holds a different branch.
2782 pub fn rectangle(
2783 &self,
2784 ) -> std::option::Option<&std::boxed::Box<google_geo_type::model::Viewport>> {
2785 #[allow(unreachable_patterns)]
2786 self.r#type.as_ref().and_then(|v| match v {
2787 crate::model::geocode_address_request::location_bias::Type::Rectangle(v) => {
2788 std::option::Option::Some(v)
2789 }
2790 _ => std::option::Option::None,
2791 })
2792 }
2793
2794 /// Sets the value of [r#type][crate::model::geocode_address_request::LocationBias::r#type]
2795 /// to hold a `Rectangle`.
2796 ///
2797 /// Note that all the setters affecting `r#type` are
2798 /// mutually exclusive.
2799 ///
2800 /// # Example
2801 /// ```ignore,no_run
2802 /// # use google_maps_geocode_v4::model::geocode_address_request::LocationBias;
2803 /// use google_geo_type::model::Viewport;
2804 /// let x = LocationBias::new().set_rectangle(Viewport::default()/* use setters */);
2805 /// assert!(x.rectangle().is_some());
2806 /// ```
2807 pub fn set_rectangle<
2808 T: std::convert::Into<std::boxed::Box<google_geo_type::model::Viewport>>,
2809 >(
2810 mut self,
2811 v: T,
2812 ) -> Self {
2813 self.r#type = std::option::Option::Some(
2814 crate::model::geocode_address_request::location_bias::Type::Rectangle(v.into()),
2815 );
2816 self
2817 }
2818 }
2819
2820 impl wkt::message::Message for LocationBias {
2821 fn typename() -> &'static str {
2822 "type.googleapis.com/google.maps.geocode.v4.GeocodeAddressRequest.LocationBias"
2823 }
2824 }
2825
2826 /// Defines additional types related to [LocationBias].
2827 pub mod location_bias {
2828 #[allow(unused_imports)]
2829 use super::*;
2830
2831 /// Types of location bias.
2832 #[derive(Clone, Debug, PartialEq)]
2833 #[non_exhaustive]
2834 pub enum Type {
2835 /// A rectangular box defined by northeast and southwest corner.
2836 /// `rectangle.high()` must be the northeast point of the rectangle
2837 /// viewport. `rectangle.low()` must be the southwest point of the
2838 /// rectangle viewport. `rectangle.low().latitude()` cannot be greater than
2839 /// `rectangle.high().latitude()`. This will result in an empty latitude
2840 /// range. A rectangle viewport cannot be wider than 180 degrees.
2841 Rectangle(std::boxed::Box<google_geo_type::model::Viewport>),
2842 }
2843 }
2844
2845 /// The address to geocode.
2846 #[derive(Clone, Debug, PartialEq)]
2847 #[non_exhaustive]
2848 pub enum AddressInput {
2849 /// The unstructured address to geocode.
2850 AddressQuery(std::string::String),
2851 /// The structured address to geocode in postal address format.
2852 Address(std::boxed::Box<google_cloud_type::model::PostalAddress>),
2853 }
2854}
2855
2856/// Request message for GeocodeService.GeocodeLocation.
2857#[derive(Clone, Default, PartialEq)]
2858#[non_exhaustive]
2859pub struct GeocodeLocationRequest {
2860 /// Optional. Language in which the results should be returned.
2861 pub language_code: std::string::String,
2862
2863 /// Optional. Region code. The region code, specified as a ccTLD ("top-level
2864 /// domain") two-character value. The parameter affects results based on
2865 /// applicable law.
2866 pub region_code: std::string::String,
2867
2868 /// Optional. A set of type tags to restrict the results. Results that do not
2869 /// have any of the specified types are removed.
2870 ///
2871 /// For the complete list of possible values, see Table A and Table B at
2872 /// <https://developers.google.com/maps/documentation/places/web-service/place-types>.
2873 pub types: std::vec::Vec<std::string::String>,
2874
2875 /// Optional. A filter of one or more location granularity enums.
2876 pub granularity: std::vec::Vec<crate::model::geocode_result::Granularity>,
2877
2878 /// The location to geocode.
2879 pub location_input: std::option::Option<crate::model::geocode_location_request::LocationInput>,
2880
2881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2882}
2883
2884impl GeocodeLocationRequest {
2885 /// Creates a new default instance.
2886 pub fn new() -> Self {
2887 std::default::Default::default()
2888 }
2889
2890 /// Sets the value of [language_code][crate::model::GeocodeLocationRequest::language_code].
2891 ///
2892 /// # Example
2893 /// ```ignore,no_run
2894 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2895 /// let x = GeocodeLocationRequest::new().set_language_code("example");
2896 /// ```
2897 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2898 self.language_code = v.into();
2899 self
2900 }
2901
2902 /// Sets the value of [region_code][crate::model::GeocodeLocationRequest::region_code].
2903 ///
2904 /// # Example
2905 /// ```ignore,no_run
2906 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2907 /// let x = GeocodeLocationRequest::new().set_region_code("example");
2908 /// ```
2909 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2910 self.region_code = v.into();
2911 self
2912 }
2913
2914 /// Sets the value of [types][crate::model::GeocodeLocationRequest::types].
2915 ///
2916 /// # Example
2917 /// ```ignore,no_run
2918 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2919 /// let x = GeocodeLocationRequest::new().set_types(["a", "b", "c"]);
2920 /// ```
2921 pub fn set_types<T, V>(mut self, v: T) -> Self
2922 where
2923 T: std::iter::IntoIterator<Item = V>,
2924 V: std::convert::Into<std::string::String>,
2925 {
2926 use std::iter::Iterator;
2927 self.types = v.into_iter().map(|i| i.into()).collect();
2928 self
2929 }
2930
2931 /// Sets the value of [granularity][crate::model::GeocodeLocationRequest::granularity].
2932 ///
2933 /// # Example
2934 /// ```ignore,no_run
2935 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2936 /// use google_maps_geocode_v4::model::geocode_result::Granularity;
2937 /// let x = GeocodeLocationRequest::new().set_granularity([
2938 /// Granularity::Rooftop,
2939 /// Granularity::RangeInterpolated,
2940 /// Granularity::GeometricCenter,
2941 /// ]);
2942 /// ```
2943 pub fn set_granularity<T, V>(mut self, v: T) -> Self
2944 where
2945 T: std::iter::IntoIterator<Item = V>,
2946 V: std::convert::Into<crate::model::geocode_result::Granularity>,
2947 {
2948 use std::iter::Iterator;
2949 self.granularity = v.into_iter().map(|i| i.into()).collect();
2950 self
2951 }
2952
2953 /// Sets the value of [location_input][crate::model::GeocodeLocationRequest::location_input].
2954 ///
2955 /// Note that all the setters affecting `location_input` are mutually
2956 /// exclusive.
2957 ///
2958 /// # Example
2959 /// ```ignore,no_run
2960 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2961 /// use google_maps_geocode_v4::model::geocode_location_request::LocationInput;
2962 /// let x = GeocodeLocationRequest::new().set_location_input(Some(LocationInput::LocationQuery("example".to_string())));
2963 /// ```
2964 pub fn set_location_input<
2965 T: std::convert::Into<
2966 std::option::Option<crate::model::geocode_location_request::LocationInput>,
2967 >,
2968 >(
2969 mut self,
2970 v: T,
2971 ) -> Self {
2972 self.location_input = v.into();
2973 self
2974 }
2975
2976 /// The value of [location_input][crate::model::GeocodeLocationRequest::location_input]
2977 /// if it holds a `LocationQuery`, `None` if the field is not set or
2978 /// holds a different branch.
2979 pub fn location_query(&self) -> std::option::Option<&std::string::String> {
2980 #[allow(unreachable_patterns)]
2981 self.location_input.as_ref().and_then(|v| match v {
2982 crate::model::geocode_location_request::LocationInput::LocationQuery(v) => {
2983 std::option::Option::Some(v)
2984 }
2985 _ => std::option::Option::None,
2986 })
2987 }
2988
2989 /// Sets the value of [location_input][crate::model::GeocodeLocationRequest::location_input]
2990 /// to hold a `LocationQuery`.
2991 ///
2992 /// Note that all the setters affecting `location_input` are
2993 /// mutually exclusive.
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
2998 /// let x = GeocodeLocationRequest::new().set_location_query("example");
2999 /// assert!(x.location_query().is_some());
3000 /// assert!(x.location().is_none());
3001 /// ```
3002 pub fn set_location_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3003 self.location_input = std::option::Option::Some(
3004 crate::model::geocode_location_request::LocationInput::LocationQuery(v.into()),
3005 );
3006 self
3007 }
3008
3009 /// The value of [location_input][crate::model::GeocodeLocationRequest::location_input]
3010 /// if it holds a `Location`, `None` if the field is not set or
3011 /// holds a different branch.
3012 pub fn location(
3013 &self,
3014 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::LatLng>> {
3015 #[allow(unreachable_patterns)]
3016 self.location_input.as_ref().and_then(|v| match v {
3017 crate::model::geocode_location_request::LocationInput::Location(v) => {
3018 std::option::Option::Some(v)
3019 }
3020 _ => std::option::Option::None,
3021 })
3022 }
3023
3024 /// Sets the value of [location_input][crate::model::GeocodeLocationRequest::location_input]
3025 /// to hold a `Location`.
3026 ///
3027 /// Note that all the setters affecting `location_input` are
3028 /// mutually exclusive.
3029 ///
3030 /// # Example
3031 /// ```ignore,no_run
3032 /// # use google_maps_geocode_v4::model::GeocodeLocationRequest;
3033 /// use google_cloud_type::model::LatLng;
3034 /// let x = GeocodeLocationRequest::new().set_location(LatLng::default()/* use setters */);
3035 /// assert!(x.location().is_some());
3036 /// assert!(x.location_query().is_none());
3037 /// ```
3038 pub fn set_location<
3039 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::LatLng>>,
3040 >(
3041 mut self,
3042 v: T,
3043 ) -> Self {
3044 self.location_input = std::option::Option::Some(
3045 crate::model::geocode_location_request::LocationInput::Location(v.into()),
3046 );
3047 self
3048 }
3049}
3050
3051impl wkt::message::Message for GeocodeLocationRequest {
3052 fn typename() -> &'static str {
3053 "type.googleapis.com/google.maps.geocode.v4.GeocodeLocationRequest"
3054 }
3055}
3056
3057/// Defines additional types related to [GeocodeLocationRequest].
3058pub mod geocode_location_request {
3059 #[allow(unused_imports)]
3060 use super::*;
3061
3062 /// The location to geocode.
3063 #[derive(Clone, Debug, PartialEq)]
3064 #[non_exhaustive]
3065 pub enum LocationInput {
3066 /// The location in the format of "lat,lng" string. For example,
3067 /// "64.7611872,-18.4705364".
3068 LocationQuery(std::string::String),
3069 /// The location in the structured format.
3070 Location(std::boxed::Box<google_cloud_type::model::LatLng>),
3071 }
3072}
3073
3074/// Request message for GeocodeService.GeocodePlace.
3075#[derive(Clone, Default, PartialEq)]
3076#[non_exhaustive]
3077pub struct GeocodePlaceRequest {
3078 /// Required. Place identifier to geocode in the format of places/{place}.
3079 pub place: std::string::String,
3080
3081 /// Optional. Language in which the results should be returned.
3082 pub language_code: std::string::String,
3083
3084 /// Optional. Region code. The region code, specified as a ccTLD ("top-level
3085 /// domain") two-character value. The parameter affects results based on
3086 /// applicable law.
3087 pub region_code: std::string::String,
3088
3089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3090}
3091
3092impl GeocodePlaceRequest {
3093 /// Creates a new default instance.
3094 pub fn new() -> Self {
3095 std::default::Default::default()
3096 }
3097
3098 /// Sets the value of [place][crate::model::GeocodePlaceRequest::place].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_maps_geocode_v4::model::GeocodePlaceRequest;
3103 /// let x = GeocodePlaceRequest::new().set_place("example");
3104 /// ```
3105 pub fn set_place<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3106 self.place = v.into();
3107 self
3108 }
3109
3110 /// Sets the value of [language_code][crate::model::GeocodePlaceRequest::language_code].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_maps_geocode_v4::model::GeocodePlaceRequest;
3115 /// let x = GeocodePlaceRequest::new().set_language_code("example");
3116 /// ```
3117 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118 self.language_code = v.into();
3119 self
3120 }
3121
3122 /// Sets the value of [region_code][crate::model::GeocodePlaceRequest::region_code].
3123 ///
3124 /// # Example
3125 /// ```ignore,no_run
3126 /// # use google_maps_geocode_v4::model::GeocodePlaceRequest;
3127 /// let x = GeocodePlaceRequest::new().set_region_code("example");
3128 /// ```
3129 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3130 self.region_code = v.into();
3131 self
3132 }
3133}
3134
3135impl wkt::message::Message for GeocodePlaceRequest {
3136 fn typename() -> &'static str {
3137 "type.googleapis.com/google.maps.geocode.v4.GeocodePlaceRequest"
3138 }
3139}
3140
3141/// Plus code (<http://plus.codes>) is a location reference with two formats:
3142/// global code defining a 14mx14m (1/8000th of a degree) or smaller rectangle,
3143/// and compound code, replacing the prefix with a reference location.
3144#[derive(Clone, Default, PartialEq)]
3145#[non_exhaustive]
3146pub struct PlusCode {
3147 /// Place's global (full) code, such as "9FWM33GV+HQ", representing an
3148 /// 1/8000 by 1/8000 degree area (~14 by 14 meters).
3149 pub global_code: std::string::String,
3150
3151 /// Place's compound code, such as "33GV+HQ, Ramberg, Norway", containing
3152 /// the suffix of the global code and replacing the prefix with a formatted
3153 /// name of a reference entity.
3154 pub compound_code: std::string::String,
3155
3156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3157}
3158
3159impl PlusCode {
3160 /// Creates a new default instance.
3161 pub fn new() -> Self {
3162 std::default::Default::default()
3163 }
3164
3165 /// Sets the value of [global_code][crate::model::PlusCode::global_code].
3166 ///
3167 /// # Example
3168 /// ```ignore,no_run
3169 /// # use google_maps_geocode_v4::model::PlusCode;
3170 /// let x = PlusCode::new().set_global_code("example");
3171 /// ```
3172 pub fn set_global_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3173 self.global_code = v.into();
3174 self
3175 }
3176
3177 /// Sets the value of [compound_code][crate::model::PlusCode::compound_code].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_maps_geocode_v4::model::PlusCode;
3182 /// let x = PlusCode::new().set_compound_code("example");
3183 /// ```
3184 pub fn set_compound_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3185 self.compound_code = v.into();
3186 self
3187 }
3188}
3189
3190impl wkt::message::Message for PlusCode {
3191 fn typename() -> &'static str {
3192 "type.googleapis.com/google.maps.geocode.v4.PlusCode"
3193 }
3194}
3195
3196/// A geocode result contains geographic information about a place.
3197#[derive(Clone, Default, PartialEq)]
3198#[non_exhaustive]
3199pub struct GeocodeResult {
3200 /// This Place's resource name, in `places/{placeId}` format. Can be used to
3201 /// look up the Place.
3202 pub place: std::string::String,
3203
3204 /// The unique identifier of a place.
3205 pub place_id: std::string::String,
3206
3207 /// The latlng of this address.
3208 pub location: std::option::Option<google_cloud_type::model::LatLng>,
3209
3210 /// The granularity of the location.
3211 pub granularity: crate::model::geocode_result::Granularity,
3212
3213 /// A viewport suitable for displaying the geocode result.
3214 pub viewport: std::option::Option<google_geo_type::model::Viewport>,
3215
3216 /// A bounding box for the address.
3217 pub bounds: std::option::Option<google_geo_type::model::Viewport>,
3218
3219 /// The one line formatted address.
3220 pub formatted_address: std::string::String,
3221
3222 /// The address in postal address format.
3223 pub postal_address: std::option::Option<google_cloud_type::model::PostalAddress>,
3224
3225 /// Repeated components for each locality level.
3226 pub address_components: std::vec::Vec<crate::model::geocode_result::AddressComponent>,
3227
3228 /// Complete list of localities contained in the postal code.
3229 ///
3230 /// This is only populated when the result is of type "postal_code".
3231 pub postal_code_localities: std::vec::Vec<google_cloud_type::model::LocalizedText>,
3232
3233 /// A set of type tags for this result. For
3234 /// example, "political" and "administrative_area".
3235 ///
3236 /// For the complete list of possible values, see Table A and Table B at
3237 /// <https://developers.google.com/maps/documentation/places/web-service/place-types>.
3238 pub types: std::vec::Vec<std::string::String>,
3239
3240 /// Plus code of the location in this geocode.
3241 pub plus_code: std::option::Option<crate::model::PlusCode>,
3242
3243 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3244}
3245
3246impl GeocodeResult {
3247 /// Creates a new default instance.
3248 pub fn new() -> Self {
3249 std::default::Default::default()
3250 }
3251
3252 /// Sets the value of [place][crate::model::GeocodeResult::place].
3253 ///
3254 /// # Example
3255 /// ```ignore,no_run
3256 /// # use google_maps_geocode_v4::model::GeocodeResult;
3257 /// let x = GeocodeResult::new().set_place("example");
3258 /// ```
3259 pub fn set_place<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3260 self.place = v.into();
3261 self
3262 }
3263
3264 /// Sets the value of [place_id][crate::model::GeocodeResult::place_id].
3265 ///
3266 /// # Example
3267 /// ```ignore,no_run
3268 /// # use google_maps_geocode_v4::model::GeocodeResult;
3269 /// let x = GeocodeResult::new().set_place_id("example");
3270 /// ```
3271 pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3272 self.place_id = v.into();
3273 self
3274 }
3275
3276 /// Sets the value of [location][crate::model::GeocodeResult::location].
3277 ///
3278 /// # Example
3279 /// ```ignore,no_run
3280 /// # use google_maps_geocode_v4::model::GeocodeResult;
3281 /// use google_cloud_type::model::LatLng;
3282 /// let x = GeocodeResult::new().set_location(LatLng::default()/* use setters */);
3283 /// ```
3284 pub fn set_location<T>(mut self, v: T) -> Self
3285 where
3286 T: std::convert::Into<google_cloud_type::model::LatLng>,
3287 {
3288 self.location = std::option::Option::Some(v.into());
3289 self
3290 }
3291
3292 /// Sets or clears the value of [location][crate::model::GeocodeResult::location].
3293 ///
3294 /// # Example
3295 /// ```ignore,no_run
3296 /// # use google_maps_geocode_v4::model::GeocodeResult;
3297 /// use google_cloud_type::model::LatLng;
3298 /// let x = GeocodeResult::new().set_or_clear_location(Some(LatLng::default()/* use setters */));
3299 /// let x = GeocodeResult::new().set_or_clear_location(None::<LatLng>);
3300 /// ```
3301 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
3302 where
3303 T: std::convert::Into<google_cloud_type::model::LatLng>,
3304 {
3305 self.location = v.map(|x| x.into());
3306 self
3307 }
3308
3309 /// Sets the value of [granularity][crate::model::GeocodeResult::granularity].
3310 ///
3311 /// # Example
3312 /// ```ignore,no_run
3313 /// # use google_maps_geocode_v4::model::GeocodeResult;
3314 /// use google_maps_geocode_v4::model::geocode_result::Granularity;
3315 /// let x0 = GeocodeResult::new().set_granularity(Granularity::Rooftop);
3316 /// let x1 = GeocodeResult::new().set_granularity(Granularity::RangeInterpolated);
3317 /// let x2 = GeocodeResult::new().set_granularity(Granularity::GeometricCenter);
3318 /// ```
3319 pub fn set_granularity<T: std::convert::Into<crate::model::geocode_result::Granularity>>(
3320 mut self,
3321 v: T,
3322 ) -> Self {
3323 self.granularity = v.into();
3324 self
3325 }
3326
3327 /// Sets the value of [viewport][crate::model::GeocodeResult::viewport].
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_maps_geocode_v4::model::GeocodeResult;
3332 /// use google_geo_type::model::Viewport;
3333 /// let x = GeocodeResult::new().set_viewport(Viewport::default()/* use setters */);
3334 /// ```
3335 pub fn set_viewport<T>(mut self, v: T) -> Self
3336 where
3337 T: std::convert::Into<google_geo_type::model::Viewport>,
3338 {
3339 self.viewport = std::option::Option::Some(v.into());
3340 self
3341 }
3342
3343 /// Sets or clears the value of [viewport][crate::model::GeocodeResult::viewport].
3344 ///
3345 /// # Example
3346 /// ```ignore,no_run
3347 /// # use google_maps_geocode_v4::model::GeocodeResult;
3348 /// use google_geo_type::model::Viewport;
3349 /// let x = GeocodeResult::new().set_or_clear_viewport(Some(Viewport::default()/* use setters */));
3350 /// let x = GeocodeResult::new().set_or_clear_viewport(None::<Viewport>);
3351 /// ```
3352 pub fn set_or_clear_viewport<T>(mut self, v: std::option::Option<T>) -> Self
3353 where
3354 T: std::convert::Into<google_geo_type::model::Viewport>,
3355 {
3356 self.viewport = v.map(|x| x.into());
3357 self
3358 }
3359
3360 /// Sets the value of [bounds][crate::model::GeocodeResult::bounds].
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_maps_geocode_v4::model::GeocodeResult;
3365 /// use google_geo_type::model::Viewport;
3366 /// let x = GeocodeResult::new().set_bounds(Viewport::default()/* use setters */);
3367 /// ```
3368 pub fn set_bounds<T>(mut self, v: T) -> Self
3369 where
3370 T: std::convert::Into<google_geo_type::model::Viewport>,
3371 {
3372 self.bounds = std::option::Option::Some(v.into());
3373 self
3374 }
3375
3376 /// Sets or clears the value of [bounds][crate::model::GeocodeResult::bounds].
3377 ///
3378 /// # Example
3379 /// ```ignore,no_run
3380 /// # use google_maps_geocode_v4::model::GeocodeResult;
3381 /// use google_geo_type::model::Viewport;
3382 /// let x = GeocodeResult::new().set_or_clear_bounds(Some(Viewport::default()/* use setters */));
3383 /// let x = GeocodeResult::new().set_or_clear_bounds(None::<Viewport>);
3384 /// ```
3385 pub fn set_or_clear_bounds<T>(mut self, v: std::option::Option<T>) -> Self
3386 where
3387 T: std::convert::Into<google_geo_type::model::Viewport>,
3388 {
3389 self.bounds = v.map(|x| x.into());
3390 self
3391 }
3392
3393 /// Sets the value of [formatted_address][crate::model::GeocodeResult::formatted_address].
3394 ///
3395 /// # Example
3396 /// ```ignore,no_run
3397 /// # use google_maps_geocode_v4::model::GeocodeResult;
3398 /// let x = GeocodeResult::new().set_formatted_address("example");
3399 /// ```
3400 pub fn set_formatted_address<T: std::convert::Into<std::string::String>>(
3401 mut self,
3402 v: T,
3403 ) -> Self {
3404 self.formatted_address = v.into();
3405 self
3406 }
3407
3408 /// Sets the value of [postal_address][crate::model::GeocodeResult::postal_address].
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_maps_geocode_v4::model::GeocodeResult;
3413 /// use google_cloud_type::model::PostalAddress;
3414 /// let x = GeocodeResult::new().set_postal_address(PostalAddress::default()/* use setters */);
3415 /// ```
3416 pub fn set_postal_address<T>(mut self, v: T) -> Self
3417 where
3418 T: std::convert::Into<google_cloud_type::model::PostalAddress>,
3419 {
3420 self.postal_address = std::option::Option::Some(v.into());
3421 self
3422 }
3423
3424 /// Sets or clears the value of [postal_address][crate::model::GeocodeResult::postal_address].
3425 ///
3426 /// # Example
3427 /// ```ignore,no_run
3428 /// # use google_maps_geocode_v4::model::GeocodeResult;
3429 /// use google_cloud_type::model::PostalAddress;
3430 /// let x = GeocodeResult::new().set_or_clear_postal_address(Some(PostalAddress::default()/* use setters */));
3431 /// let x = GeocodeResult::new().set_or_clear_postal_address(None::<PostalAddress>);
3432 /// ```
3433 pub fn set_or_clear_postal_address<T>(mut self, v: std::option::Option<T>) -> Self
3434 where
3435 T: std::convert::Into<google_cloud_type::model::PostalAddress>,
3436 {
3437 self.postal_address = v.map(|x| x.into());
3438 self
3439 }
3440
3441 /// Sets the value of [address_components][crate::model::GeocodeResult::address_components].
3442 ///
3443 /// # Example
3444 /// ```ignore,no_run
3445 /// # use google_maps_geocode_v4::model::GeocodeResult;
3446 /// use google_maps_geocode_v4::model::geocode_result::AddressComponent;
3447 /// let x = GeocodeResult::new()
3448 /// .set_address_components([
3449 /// AddressComponent::default()/* use setters */,
3450 /// AddressComponent::default()/* use (different) setters */,
3451 /// ]);
3452 /// ```
3453 pub fn set_address_components<T, V>(mut self, v: T) -> Self
3454 where
3455 T: std::iter::IntoIterator<Item = V>,
3456 V: std::convert::Into<crate::model::geocode_result::AddressComponent>,
3457 {
3458 use std::iter::Iterator;
3459 self.address_components = v.into_iter().map(|i| i.into()).collect();
3460 self
3461 }
3462
3463 /// Sets the value of [postal_code_localities][crate::model::GeocodeResult::postal_code_localities].
3464 ///
3465 /// # Example
3466 /// ```ignore,no_run
3467 /// # use google_maps_geocode_v4::model::GeocodeResult;
3468 /// use google_cloud_type::model::LocalizedText;
3469 /// let x = GeocodeResult::new()
3470 /// .set_postal_code_localities([
3471 /// LocalizedText::default()/* use setters */,
3472 /// LocalizedText::default()/* use (different) setters */,
3473 /// ]);
3474 /// ```
3475 pub fn set_postal_code_localities<T, V>(mut self, v: T) -> Self
3476 where
3477 T: std::iter::IntoIterator<Item = V>,
3478 V: std::convert::Into<google_cloud_type::model::LocalizedText>,
3479 {
3480 use std::iter::Iterator;
3481 self.postal_code_localities = v.into_iter().map(|i| i.into()).collect();
3482 self
3483 }
3484
3485 /// Sets the value of [types][crate::model::GeocodeResult::types].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_maps_geocode_v4::model::GeocodeResult;
3490 /// let x = GeocodeResult::new().set_types(["a", "b", "c"]);
3491 /// ```
3492 pub fn set_types<T, V>(mut self, v: T) -> Self
3493 where
3494 T: std::iter::IntoIterator<Item = V>,
3495 V: std::convert::Into<std::string::String>,
3496 {
3497 use std::iter::Iterator;
3498 self.types = v.into_iter().map(|i| i.into()).collect();
3499 self
3500 }
3501
3502 /// Sets the value of [plus_code][crate::model::GeocodeResult::plus_code].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_maps_geocode_v4::model::GeocodeResult;
3507 /// use google_maps_geocode_v4::model::PlusCode;
3508 /// let x = GeocodeResult::new().set_plus_code(PlusCode::default()/* use setters */);
3509 /// ```
3510 pub fn set_plus_code<T>(mut self, v: T) -> Self
3511 where
3512 T: std::convert::Into<crate::model::PlusCode>,
3513 {
3514 self.plus_code = std::option::Option::Some(v.into());
3515 self
3516 }
3517
3518 /// Sets or clears the value of [plus_code][crate::model::GeocodeResult::plus_code].
3519 ///
3520 /// # Example
3521 /// ```ignore,no_run
3522 /// # use google_maps_geocode_v4::model::GeocodeResult;
3523 /// use google_maps_geocode_v4::model::PlusCode;
3524 /// let x = GeocodeResult::new().set_or_clear_plus_code(Some(PlusCode::default()/* use setters */));
3525 /// let x = GeocodeResult::new().set_or_clear_plus_code(None::<PlusCode>);
3526 /// ```
3527 pub fn set_or_clear_plus_code<T>(mut self, v: std::option::Option<T>) -> Self
3528 where
3529 T: std::convert::Into<crate::model::PlusCode>,
3530 {
3531 self.plus_code = v.map(|x| x.into());
3532 self
3533 }
3534}
3535
3536impl wkt::message::Message for GeocodeResult {
3537 fn typename() -> &'static str {
3538 "type.googleapis.com/google.maps.geocode.v4.GeocodeResult"
3539 }
3540}
3541
3542/// Defines additional types related to [GeocodeResult].
3543pub mod geocode_result {
3544 #[allow(unused_imports)]
3545 use super::*;
3546
3547 /// The structured components that form the formatted address, if this
3548 /// information is available.
3549 #[derive(Clone, Default, PartialEq)]
3550 #[non_exhaustive]
3551 pub struct AddressComponent {
3552 /// The full text description or name of the address component. For example,
3553 /// an address component for the country Australia may have a long name of
3554 /// "Australia".
3555 pub long_text: std::string::String,
3556
3557 /// An abbreviated textual name for the address component, if available. For
3558 /// example, an address component for the country of Australia may have a
3559 /// short name of "AU".
3560 pub short_text: std::string::String,
3561
3562 /// An array indicating the type(s) of the address component.
3563 ///
3564 /// See
3565 /// <https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types>
3566 /// for more details.
3567 pub types: std::vec::Vec<std::string::String>,
3568
3569 /// The language used to format this component, in CLDR notation.
3570 pub language_code: std::string::String,
3571
3572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3573 }
3574
3575 impl AddressComponent {
3576 /// Creates a new default instance.
3577 pub fn new() -> Self {
3578 std::default::Default::default()
3579 }
3580
3581 /// Sets the value of [long_text][crate::model::geocode_result::AddressComponent::long_text].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_maps_geocode_v4::model::geocode_result::AddressComponent;
3586 /// let x = AddressComponent::new().set_long_text("example");
3587 /// ```
3588 pub fn set_long_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3589 self.long_text = v.into();
3590 self
3591 }
3592
3593 /// Sets the value of [short_text][crate::model::geocode_result::AddressComponent::short_text].
3594 ///
3595 /// # Example
3596 /// ```ignore,no_run
3597 /// # use google_maps_geocode_v4::model::geocode_result::AddressComponent;
3598 /// let x = AddressComponent::new().set_short_text("example");
3599 /// ```
3600 pub fn set_short_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3601 self.short_text = v.into();
3602 self
3603 }
3604
3605 /// Sets the value of [types][crate::model::geocode_result::AddressComponent::types].
3606 ///
3607 /// # Example
3608 /// ```ignore,no_run
3609 /// # use google_maps_geocode_v4::model::geocode_result::AddressComponent;
3610 /// let x = AddressComponent::new().set_types(["a", "b", "c"]);
3611 /// ```
3612 pub fn set_types<T, V>(mut self, v: T) -> Self
3613 where
3614 T: std::iter::IntoIterator<Item = V>,
3615 V: std::convert::Into<std::string::String>,
3616 {
3617 use std::iter::Iterator;
3618 self.types = v.into_iter().map(|i| i.into()).collect();
3619 self
3620 }
3621
3622 /// Sets the value of [language_code][crate::model::geocode_result::AddressComponent::language_code].
3623 ///
3624 /// # Example
3625 /// ```ignore,no_run
3626 /// # use google_maps_geocode_v4::model::geocode_result::AddressComponent;
3627 /// let x = AddressComponent::new().set_language_code("example");
3628 /// ```
3629 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
3630 mut self,
3631 v: T,
3632 ) -> Self {
3633 self.language_code = v.into();
3634 self
3635 }
3636 }
3637
3638 impl wkt::message::Message for AddressComponent {
3639 fn typename() -> &'static str {
3640 "type.googleapis.com/google.maps.geocode.v4.GeocodeResult.AddressComponent"
3641 }
3642 }
3643
3644 /// The granularity of the location.
3645 ///
3646 /// # Working with unknown values
3647 ///
3648 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3649 /// additional enum variants at any time. Adding new variants is not considered
3650 /// a breaking change. Applications should write their code in anticipation of:
3651 ///
3652 /// - New values appearing in future releases of the client library, **and**
3653 /// - New values received dynamically, without application changes.
3654 ///
3655 /// Please consult the [Working with enums] section in the user guide for some
3656 /// guidelines.
3657 ///
3658 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3659 #[derive(Clone, Debug, PartialEq)]
3660 #[non_exhaustive]
3661 pub enum Granularity {
3662 /// Do not use.
3663 Unspecified,
3664 /// The non-interpolated location of an actual plot of land corresponding
3665 /// to the matched address.
3666 Rooftop,
3667 /// Interpolated from a range of street numbers. For example, if we know
3668 /// that a segment of Amphitheatre Pkwy contains numbers 1600 - 1699, then
3669 /// 1650 might be placed halfway between its endpoints.
3670 RangeInterpolated,
3671 /// The geometric center of a feature for which we have polygonal data.
3672 GeometricCenter,
3673 /// Everything else.
3674 Approximate,
3675 /// If set, the enum was initialized with an unknown value.
3676 ///
3677 /// Applications can examine the value using [Granularity::value] or
3678 /// [Granularity::name].
3679 UnknownValue(granularity::UnknownValue),
3680 }
3681
3682 #[doc(hidden)]
3683 pub mod granularity {
3684 #[allow(unused_imports)]
3685 use super::*;
3686 #[derive(Clone, Debug, PartialEq)]
3687 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3688 }
3689
3690 impl Granularity {
3691 /// Gets the enum value.
3692 ///
3693 /// Returns `None` if the enum contains an unknown value deserialized from
3694 /// the string representation of enums.
3695 pub fn value(&self) -> std::option::Option<i32> {
3696 match self {
3697 Self::Unspecified => std::option::Option::Some(0),
3698 Self::Rooftop => std::option::Option::Some(1),
3699 Self::RangeInterpolated => std::option::Option::Some(2),
3700 Self::GeometricCenter => std::option::Option::Some(3),
3701 Self::Approximate => std::option::Option::Some(4),
3702 Self::UnknownValue(u) => u.0.value(),
3703 }
3704 }
3705
3706 /// Gets the enum value as a string.
3707 ///
3708 /// Returns `None` if the enum contains an unknown value deserialized from
3709 /// the integer representation of enums.
3710 pub fn name(&self) -> std::option::Option<&str> {
3711 match self {
3712 Self::Unspecified => std::option::Option::Some("GRANULARITY_UNSPECIFIED"),
3713 Self::Rooftop => std::option::Option::Some("ROOFTOP"),
3714 Self::RangeInterpolated => std::option::Option::Some("RANGE_INTERPOLATED"),
3715 Self::GeometricCenter => std::option::Option::Some("GEOMETRIC_CENTER"),
3716 Self::Approximate => std::option::Option::Some("APPROXIMATE"),
3717 Self::UnknownValue(u) => u.0.name(),
3718 }
3719 }
3720 }
3721
3722 impl std::default::Default for Granularity {
3723 fn default() -> Self {
3724 use std::convert::From;
3725 Self::from(0)
3726 }
3727 }
3728
3729 impl std::fmt::Display for Granularity {
3730 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3731 wkt::internal::display_enum(f, self.name(), self.value())
3732 }
3733 }
3734
3735 impl std::convert::From<i32> for Granularity {
3736 fn from(value: i32) -> Self {
3737 match value {
3738 0 => Self::Unspecified,
3739 1 => Self::Rooftop,
3740 2 => Self::RangeInterpolated,
3741 3 => Self::GeometricCenter,
3742 4 => Self::Approximate,
3743 _ => Self::UnknownValue(granularity::UnknownValue(
3744 wkt::internal::UnknownEnumValue::Integer(value),
3745 )),
3746 }
3747 }
3748 }
3749
3750 impl std::convert::From<&str> for Granularity {
3751 fn from(value: &str) -> Self {
3752 use std::string::ToString;
3753 match value {
3754 "GRANULARITY_UNSPECIFIED" => Self::Unspecified,
3755 "ROOFTOP" => Self::Rooftop,
3756 "RANGE_INTERPOLATED" => Self::RangeInterpolated,
3757 "GEOMETRIC_CENTER" => Self::GeometricCenter,
3758 "APPROXIMATE" => Self::Approximate,
3759 _ => Self::UnknownValue(granularity::UnknownValue(
3760 wkt::internal::UnknownEnumValue::String(value.to_string()),
3761 )),
3762 }
3763 }
3764 }
3765
3766 impl serde::ser::Serialize for Granularity {
3767 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3768 where
3769 S: serde::Serializer,
3770 {
3771 match self {
3772 Self::Unspecified => serializer.serialize_i32(0),
3773 Self::Rooftop => serializer.serialize_i32(1),
3774 Self::RangeInterpolated => serializer.serialize_i32(2),
3775 Self::GeometricCenter => serializer.serialize_i32(3),
3776 Self::Approximate => serializer.serialize_i32(4),
3777 Self::UnknownValue(u) => u.0.serialize(serializer),
3778 }
3779 }
3780 }
3781
3782 impl<'de> serde::de::Deserialize<'de> for Granularity {
3783 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3784 where
3785 D: serde::Deserializer<'de>,
3786 {
3787 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Granularity>::new(
3788 ".google.maps.geocode.v4.GeocodeResult.Granularity",
3789 ))
3790 }
3791 }
3792}
3793
3794/// Response message for
3795/// [GeocodeService.GeocodeAddress][google.maps.geocode.v4.GeocodeService.GeocodeAddress].
3796///
3797/// [google.maps.geocode.v4.GeocodeService.GeocodeAddress]: crate::client::GeocodeService::geocode_address
3798#[derive(Clone, Default, PartialEq)]
3799#[non_exhaustive]
3800pub struct GeocodeAddressResponse {
3801 /// The geocoding result.
3802 pub results: std::vec::Vec<crate::model::GeocodeResult>,
3803
3804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3805}
3806
3807impl GeocodeAddressResponse {
3808 /// Creates a new default instance.
3809 pub fn new() -> Self {
3810 std::default::Default::default()
3811 }
3812
3813 /// Sets the value of [results][crate::model::GeocodeAddressResponse::results].
3814 ///
3815 /// # Example
3816 /// ```ignore,no_run
3817 /// # use google_maps_geocode_v4::model::GeocodeAddressResponse;
3818 /// use google_maps_geocode_v4::model::GeocodeResult;
3819 /// let x = GeocodeAddressResponse::new()
3820 /// .set_results([
3821 /// GeocodeResult::default()/* use setters */,
3822 /// GeocodeResult::default()/* use (different) setters */,
3823 /// ]);
3824 /// ```
3825 pub fn set_results<T, V>(mut self, v: T) -> Self
3826 where
3827 T: std::iter::IntoIterator<Item = V>,
3828 V: std::convert::Into<crate::model::GeocodeResult>,
3829 {
3830 use std::iter::Iterator;
3831 self.results = v.into_iter().map(|i| i.into()).collect();
3832 self
3833 }
3834}
3835
3836impl wkt::message::Message for GeocodeAddressResponse {
3837 fn typename() -> &'static str {
3838 "type.googleapis.com/google.maps.geocode.v4.GeocodeAddressResponse"
3839 }
3840}
3841
3842/// Response message for
3843/// [GeocodeService.GeocodeLocation][google.maps.geocode.v4.GeocodeService.GeocodeLocation].
3844///
3845/// [google.maps.geocode.v4.GeocodeService.GeocodeLocation]: crate::client::GeocodeService::geocode_location
3846#[derive(Clone, Default, PartialEq)]
3847#[non_exhaustive]
3848pub struct GeocodeLocationResponse {
3849 /// The geocoding result.
3850 pub results: std::vec::Vec<crate::model::GeocodeResult>,
3851
3852 /// Plus code of the location in the request.
3853 pub plus_code: std::option::Option<crate::model::PlusCode>,
3854
3855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3856}
3857
3858impl GeocodeLocationResponse {
3859 /// Creates a new default instance.
3860 pub fn new() -> Self {
3861 std::default::Default::default()
3862 }
3863
3864 /// Sets the value of [results][crate::model::GeocodeLocationResponse::results].
3865 ///
3866 /// # Example
3867 /// ```ignore,no_run
3868 /// # use google_maps_geocode_v4::model::GeocodeLocationResponse;
3869 /// use google_maps_geocode_v4::model::GeocodeResult;
3870 /// let x = GeocodeLocationResponse::new()
3871 /// .set_results([
3872 /// GeocodeResult::default()/* use setters */,
3873 /// GeocodeResult::default()/* use (different) setters */,
3874 /// ]);
3875 /// ```
3876 pub fn set_results<T, V>(mut self, v: T) -> Self
3877 where
3878 T: std::iter::IntoIterator<Item = V>,
3879 V: std::convert::Into<crate::model::GeocodeResult>,
3880 {
3881 use std::iter::Iterator;
3882 self.results = v.into_iter().map(|i| i.into()).collect();
3883 self
3884 }
3885
3886 /// Sets the value of [plus_code][crate::model::GeocodeLocationResponse::plus_code].
3887 ///
3888 /// # Example
3889 /// ```ignore,no_run
3890 /// # use google_maps_geocode_v4::model::GeocodeLocationResponse;
3891 /// use google_maps_geocode_v4::model::PlusCode;
3892 /// let x = GeocodeLocationResponse::new().set_plus_code(PlusCode::default()/* use setters */);
3893 /// ```
3894 pub fn set_plus_code<T>(mut self, v: T) -> Self
3895 where
3896 T: std::convert::Into<crate::model::PlusCode>,
3897 {
3898 self.plus_code = std::option::Option::Some(v.into());
3899 self
3900 }
3901
3902 /// Sets or clears the value of [plus_code][crate::model::GeocodeLocationResponse::plus_code].
3903 ///
3904 /// # Example
3905 /// ```ignore,no_run
3906 /// # use google_maps_geocode_v4::model::GeocodeLocationResponse;
3907 /// use google_maps_geocode_v4::model::PlusCode;
3908 /// let x = GeocodeLocationResponse::new().set_or_clear_plus_code(Some(PlusCode::default()/* use setters */));
3909 /// let x = GeocodeLocationResponse::new().set_or_clear_plus_code(None::<PlusCode>);
3910 /// ```
3911 pub fn set_or_clear_plus_code<T>(mut self, v: std::option::Option<T>) -> Self
3912 where
3913 T: std::convert::Into<crate::model::PlusCode>,
3914 {
3915 self.plus_code = v.map(|x| x.into());
3916 self
3917 }
3918}
3919
3920impl wkt::message::Message for GeocodeLocationResponse {
3921 fn typename() -> &'static str {
3922 "type.googleapis.com/google.maps.geocode.v4.GeocodeLocationResponse"
3923 }
3924}