google_maps/distance_matrix/request/
with_region.rs

1impl crate::distance_matrix::Request<'_> {
2    /// Specifies the region bias. There is a London in Canada and there is a
3    /// London in England. By biasing the region, you help the directions
4    /// service choose the London you intended.
5    ///
6    /// ## Arguments
7    ///
8    /// * `region` ‧ A country to bias your geocoding results to.
9    ///
10    /// ## Description
11    ///
12    /// [Region Biasing](https://developers.google.com/maps/documentation/directions/intro#RegionBiasing)
13    ///
14    /// You can set the Directions service to return results from a specific
15    /// region by using the `region` parameter. You may utilize any domain in
16    /// which the main Google Maps application has launched driving directions.
17    ///
18    /// For example, a directions request for "Toledo" to "Madrid" returns
19    /// appropriate results when `region` is set to `Region::Spain` and "Toledo"
20    /// is then interpreted as the Spanish city. A directions request for
21    /// "Toledo" to "Madrid" sent without a `region` parameter does not return
22    /// results, because "Toledo" is interpreted as the city in Ohio and not
23    /// Spain.
24    ///
25    /// ## Example
26    ///
27    /// * Bias region to Canada:
28    /// ```rust
29    /// .with_region(Region::Canada)
30    /// ```
31    #[must_use] pub fn with_region(
32        mut self,
33        region: impl Into<crate::types::Region>
34    ) -> Self {
35        self.region = Some(region.into());
36        self
37    } // fn
38} // impl