Skip to main content

google_maps/roads/nearest_roads/request/
new.rs

1// =============================================================================
2
3impl<'r> crate::roads::nearest_roads::request::Request<'r> {
4    // -------------------------------------------------------------------------
5    //
6    /// Initializes the builder pattern for a Nearest Roads query with the
7    /// required parameters.
8    ///
9    /// Note: The snapping algorithm works best for points that are not too far
10    /// apart. If you observe odd snapping behavior, try creating paths that
11    /// have points closer together. To ensure the best snap-to-road quality,
12    /// you should aim to provide paths on which consecutive pairs of points are
13    /// within 300m of each other. This will also help in handling any isolated,
14    /// long jumps between consecutive points caused by GPS signal loss, or
15    /// noise.
16    ///
17    /// ## Arguments
18    ///
19    /// * `client` ‧ Your application's Google Maps API client struct.
20    ///
21    /// * `points` ‧ The points to be snapped. The points parameter accepts a
22    ///   list of latitude/longitude pairs.
23    #[must_use]
24    pub const fn new(
25        client: &'r crate::client::Client,
26        points: Vec<crate::types::LatLng>
27    ) -> Self {
28        // Instantiate struct and return it to caller:
29        Self {
30            // Required parameters:
31            client,
32            points,
33        } // struct
34    } // fn
35} // impl