google_maps/distance_matrix/request/execute.rs
1impl crate::distance_matrix::Request<'_> {
2 /// Executes the Google Maps Distance Matrix API request.
3 ///
4 /// ## Description
5 ///
6 /// This method will:
7 ///
8 /// 1. Validate the request `struct` that has been built,
9 ///
10 /// 2. Build a [URL](https://en.wikipedia.org/wiki/Uniform_Resource_Locator)
11 /// and [query string](https://en.wikipedia.org/wiki/Query_string) for an
12 /// [HTTP](https://en.wikipedia.org/wiki/HTTP)
13 /// [GET](https://www.w3schools.com/tags/ref_httpmethods.asp) request,
14 ///
15 /// 3. Perform the [HTTP](https://en.wikipedia.org/wiki/HTTP)
16 /// [GET](https://www.w3schools.com/tags/ref_httpmethods.asp) request
17 /// using the [reqwest](https://crates.io/crates/reqwest) crate.
18 ///
19 /// ## Arguments
20 ///
21 /// This method accepts no arguments.
22 ///
23 /// # Errors
24 ///
25 /// This method can fail if:
26 ///
27 /// * This can fail if the request `struct` fails validation. For example,
28 /// parameters in the request conflict with one another, or the request
29 /// parameters are set in a way that's incompatible.
30 ///
31 /// For example, Google Maps Directions API cannot calculate alternative
32 /// routes if waypoints have been set. This will cause a validation
33 /// failure.
34 ///
35 /// * The HTTP client cannot make a connection to the Google Maps API
36 /// server, or successfully send the request or receive the resposne over
37 /// the network.
38 ///
39 /// * The Google Maps API server returns an unexpected response, or data in
40 /// a format that's not expected.
41 pub async fn execute(
42 self
43 ) -> Result<crate::distance_matrix::Response, crate::Error> {
44 self.client.get_request(self).await
45 } // fn
46} // impl