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
use crate::{
    elevation::request::{locations::Locations, Request},
    latlng::LatLng,
}; // use crate

impl<'a> Request<'a> {

    /// Adds the _positional request_ parameter to the Elevation API query.
    ///
    /// ## Arguments:
    ///
    /// * `location` ‧ Defines the location on the earth from which to
    /// return elevation data. This parameter takes a single `LatLng`
    /// coordinate.
    ///
    /// ## Example:
    ///
    /// ```rust
    /// // Denver, Colorado, the "Mile High City"
    /// .for_positional_request(LatLng::try_from(dec!(39.7391536), dec!(-104.9847034)).unwrap())
    /// ```

    pub fn for_positional_request(
        &'a mut self,
        location: LatLng
    ) -> &'a mut Request {
        // Set the path in Request struct.
        self.locations = Some(Locations::LatLngs(vec![location]));
        // Return modified Request struct to caller.
        self
    } // fn

    /// Adds a single _positional request_ parameter to the Elevation API query.
    ///
    /// ## Arguments:
    ///
    /// * `locations` ‧ Defines the location(s) on the earth from which to
    /// return elevation data. This parameter takes either a single location,
    /// as a latitude/longitude pair, multiple latitude/longitude pairs, or an
    /// encoded polyline. For more information, see [Specifying
    /// Locations](https://developers.google.com/maps/documentation/elevation/intro#Locations).
    ///
    /// ## Example:
    ///
    /// ```rust
    /// .for_positional_requests(ElevationLocations::LatLngs(vec![
    ///     // Denver, Colorado, the "Mile High City"
    ///     LatLng::try_from(dec!(39.7391536), dec!(-104.9847034)).unwrap(),
    ///     // Death Valley
    ///     LatLng::try_from(dec!(36.23998), dec!(-116.83171)).unwrap(),
    /// ]))
    /// ```

    pub fn for_positional_requests(
        &'a mut self,
        locations: Locations
    ) -> &'a mut Request {
        // Set the path in Request struct.
        self.locations = Some(locations);
        // Return modified Request struct to caller.
        self
    } // fn

} // impl