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
use crate::types::LatLng;
// -----------------------------------------------------------------------------
impl crate::places::place_autocomplete::Request<'_> {
/// Adds the location and radius parameters to the Place API _Place
/// Autocomplete_ query.
///
/// ## Arguments
///
/// * `location` ‧ The point around which to retrieve place information.
/// Note: When using the Text Search API, the `location` parameter may be
/// overriden if the `query` contains an explicit location such as `Market
/// in Barcelona`.
///
/// * `radius` ‧ Defines the distance (in meters) within which to return
/// place results. You may bias results to a specified circle by passing a
/// `location` and a `radius` parameter. Doing so instructs the Places
/// service to prefer showing results within that circle; results outside of
/// the defined area may still be displayed.
///
/// The radius will automatically be clamped to a maximum value depending on
/// the type of search and other parameters.
///
/// * Autocomplete: 50,000 meters
/// * Nearby Search:
/// * with `keyword` or `name`: 50,000 meters
/// * without `keyword` or `name`
/// * Up to 50,000 meters, adjusted dynamically based on area
/// density, independent of `rankby` parameter.
/// * When using `rankby=distance`, the radius parameter will not be
/// accepted, and will result in an `INVALID_REQUEST`.
/// * Query Autocomplete: 50,000 meters
/// * Text Search: 50,000 meters
#[must_use] pub fn with_location_and_radius(
mut self,
location: impl Into<LatLng>,
radius: impl Into<u32>
) -> Self {
// Set location in Request struct.
self.location = Some(location.into());
// Set radius in Request struct.
self.radius = Some(radius.into());
// Return modified Request struct to caller.
self
} // fn
/// Adds the location and radius parameters to the Place API _Place
/// Autocomplete_ query.
///
/// ## Arguments
///
/// * `location` ‧ The point around which to retrieve place information.
/// Note: When using the Text Search API, the `location` parameter may be
/// overriden if the `query` contains an explicit location such as `Market
/// in Barcelona`.
///
/// * `radius` ‧ Defines the distance (in meters) within which to return
/// place results. You may bias results to a specified circle by passing a
/// `location` and a `radius` parameter. Doing so instructs the Places
/// service to prefer showing results within that circle; results outside
/// of the defined area may still be displayed. The radius will
/// automatically be clamped to a maximum value depending on the type of
/// search and other parameters.
///
/// * `strictbounds` ‧ Returns only those places that are strictly within
/// the region defined by `location` and `radius`. This is a restriction,
/// rather than a bias, meaning that results outside this region will not
/// be returned even if they match the user input.
#[must_use] pub fn with_strict_location_and_radius(
mut self,
location: impl Into<LatLng>,
radius: impl Into<u32>
) -> Self {
// Set location in Request struct.
self.location = Some(location.into());
// Set radius in Request struct.
self.radius = Some(radius.into());
// Set strictbounds in Request struct:
self.strictbounds = Some(true);
// Return modified Request struct to caller.
self
} // fn
} // impl