Struct google_maps::roads::snap_to_roads::request::Request
source · pub struct Request<'a> { /* private fields */ }
Expand description
Look at this Request
struct for documentation on how to build your Snap
To Roads query. The methods implemented for this struct are what’s used
to build your request.
Implementations§
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub async fn execute(
&'a mut self
) -> Result<SnapToRoadsResponse, GoogleMapsError>
pub async fn execute( &'a mut self ) -> Result<SnapToRoadsResponse, GoogleMapsError>
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub async fn get(&mut self) -> Result<SnapToRoadsResponse, GoogleMapsError>
pub async fn get(&mut self) -> Result<SnapToRoadsResponse, GoogleMapsError>
Performs the HTTP get request and returns the response to the caller.
§Arguments
This method accepts no arguments.
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn new(client: &GoogleMapsClient, path: Vec<LatLng>) -> Request<'_>
pub fn new(client: &GoogleMapsClient, path: Vec<LatLng>) -> Request<'_>
Initializes the builder pattern for a Snap To Roads query with the required, non-optional parameters.
§Arguments
-
client
‧ Your application’s Google Maps API client struct. -
path
‧ The path to be snapped. Note: The snapping algorithm works best for points that are not too far apart. If you observe odd snapping behavior, try creating paths that have points closer together. To ensure the best snap-to-road quality, you should aim to provide paths on which consecutive pairs of points are within 300m of each other. This will also help in handling any isolated, long jumps between consecutive points caused by GPS signal loss, or noise.
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn query_url(&'a mut self) -> String
pub fn query_url(&'a mut self) -> String
Returns the URL query string that represents the query you’ve built.
§Description
Returns the query string that will be sent to the Google Maps API. It is the result of the builder pattern. This method could be useful for records or logging. It could also be used for passing to your HTTP client of choice and executing the HTTP GET request yourself.
§Arguments
This method accepts no arguments.
source§impl<'a> Request<'a>
impl<'a> Request<'a>
sourcepub fn with_interpolation(&'a mut self, interpolate: bool) -> &'a mut Self
pub fn with_interpolation(&'a mut self, interpolate: bool) -> &'a mut Self
Whether to interpolate a path to include all points forming the full road-geometry.
§Arguments
interpolate
‧ Whentrue
, additional interpolated points will also be returned, resulting in a path that smoothly follows the geometry of the road, even around corners and through tunnels. Interpolated paths will most likely contain more points than the original path. Defaults tofalse
.
§Example
- Turn on interpolation:
.with_interpolation(true)