1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use crate::types::LatLng;
// =============================================================================
impl<'r> crate::geocoding::reverse::ReverseRequest<'r> {
// -------------------------------------------------------------------------
//
/// Initializes the builder pattern for a Geolocation API query with the
/// required, non-optional parameters.
///
/// # Arguments:
///
/// * `client` ‧ Your application's Google Maps API client struct.
///
/// * `latlng` ‧ The latitude and longitude values specifying the location
/// for which you wish to obtain the closest, human-readable address.
#[must_use]
pub const fn new(
client: &'r crate::client::Client,
latlng: LatLng
) -> Self {
// Instantiate struct and return it to caller:
Self {
// Required parameters:
client,
latlng,
// Optional parameters:
language: None,
location_types: Vec::new(),
result_types: Vec::new(),
} // struct
} // fn
// -------------------------------------------------------------------------
//
/// Initializes the builder pattern for a Geolocation API query with the
/// required, non-optional parameters.
///
/// This function is the same as `new` but it supports
/// the [geo](https://crates.io/crates/geo) crate's
/// [Coord](https://docs.rs/geo/latest/geo/geometry/struct.Coord.html) type.
///
/// # Arguments:
///
/// * `client` ‧ Your application's Google Maps API client struct.
/// * `coordinate` ‧ The `Coord` specifying the location for which you
/// wish to obtain the closest, human-readable address.
#[cfg(feature = "geo")]
pub fn try_new_coordinate(
client: &'r crate::client::Client,
coordinate: &geo_types::Coord
) -> Result<Self, crate::error::Error> {
// Instantiate struct and return it to caller:
Ok(Self {
// Required parameters:
client,
latlng: LatLng::try_from(coordinate)?,
// Optional parameters:
language: None,
location_types: Vec::new(),
result_types: Vec::new(),
}) // struct
} // fn
// -------------------------------------------------------------------------
//
/// Initializes the builder pattern for a Geolocation API query with the
/// required, non-optional parameters.
///
/// This function is the same as `new` but it supports
/// the [geo](https://crates.io/crates/geo) crate's
/// [Point](https://docs.rs/geo/latest/geo/geometry/struct.Point.html) type.
///
/// # Arguments:
///
/// * `client` ‧ Your application's Google Maps API client struct.
/// * `point` ‧ The `Point` specifying the location for which you wish to
/// obtain the closest, human-readable address.
#[cfg(feature = "geo")]
pub fn try_new_point(
client: &'r crate::client::Client,
point: &geo_types::Point
) -> Result<Self, crate::error::Error> {
// Instantiate struct and return it to caller:
Ok(Self {
// Required parameters:
client,
latlng: LatLng::try_from(point)?,
// Optional parameters:
language: None,
location_types: Vec::new(),
result_types: Vec::new(),
}) // struct
} // fn
} // impl