google_maps2/places/query_autocomplete/request/with_location.rs
1use crate::places::query_autocomplete::request::Request;
2use crate::types::LatLng;
3
4// -----------------------------------------------------------------------------
5
6impl<'a> Request<'a> {
7 /// Adds the location and radius parameters to the Place API _Query
8 /// Autocomplete_ query.
9 ///
10 /// ## Arguments
11 ///
12 /// * `location` ‧ The point around which to retrieve place information.
13 /// Note: When using the Text Search API, the `location` parameter may be
14 /// overriden if the `query` contains an explicit location such as `Market
15 /// in Barcelona`.
16 ///
17 /// * `radius` ‧ Defines the distance (in meters) within which to return
18 /// place results. You may bias results to a specified circle by passing a
19 /// `location` and a `radius` parameter. Doing so instructs the Places
20 /// service to prefer showing results within that circle; results outside of
21 /// the defined area may still be displayed.
22 ///
23 /// The radius will automatically be clamped to a maximum value depending on
24 /// the type of search and other parameters.
25 ///
26 /// * Autocomplete: 50,000 meters
27 /// * Nearby Search:
28 /// * with `keyword` or `name`: 50,000 meters
29 /// * without `keyword` or `name`
30 /// * Up to 50,000 meters, adjusted dynamically based on area
31 /// density, independent of `rankby` parameter.
32 /// * When using `rankby=distance`, the radius parameter will not be
33 /// accepted, and will result in an `INVALID_REQUEST`.
34 /// * Query Autocomplete: 50,000 meters
35 /// * Text Search: 50,000 meters
36
37 pub fn with_location_and_radius(
38 &'a mut self,
39 location: impl Into<LatLng>,
40 radius: u32,
41 ) -> &'a mut Self {
42 // Set location in Request struct.
43 self.location = Some(location.into());
44 // Set radius in Request struct.
45 self.radius = Some(radius);
46 // Return modified Request struct to caller.
47 self
48 } // fn
49} // impl