[][src]Struct google_maps::elevation::request::Request

pub struct Request<'a> { /* fields omitted */ }

Look at this Request struct for documentation on how to build your Time Zone API query. The methods implemented for this struct are what's used to build your request.

Methods

impl<'a> Request<'a>[src]

pub fn build(&mut self) -> Result<&'a mut Request, Error>[src]

Builds the query string for the Google Maps Elevation API based on the input provided by the client.

Arguments:

This method accepts no arguments.

impl<'a> Request<'a>[src]

pub fn execute(&'a mut self) -> Result<Response, Error>[src]

Executes the query you've built.

Description:

My adventures in Rust became messy so I had to make this method. It wraps the .validate()?.build()?.get()? chain needed at the end of the builder pattern.

Arguments:

This method accepts no arguments.

impl<'a> Request<'a>[src]

pub fn for_positional_request(&'a mut self, location: LatLng) -> &'a mut Request[src]

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:

// Denver, Colorado, the "Mile High City"
.for_positional_request(LatLng::try_from(dec!(39.7391536), dec!(-104.9847034)).unwrap())

pub fn for_positional_requests(
    &'a mut self,
    locations: Locations
) -> &'a mut Request
[src]

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.

Example:

.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(),
]))

impl<'a> Request<'a>[src]

pub fn for_sampled_path_request(
    &'a mut self,
    path: Locations,
    samples: u8
) -> &'a mut Request
[src]

Adds the sampled path request parameters to the Elevation API query.

Arguments:

  • path ‧ Defines a path on the earth for which to return elevation data. This parameter defines a set of two or more ordered latitude/longitude pairs defining a path along the surface of the earth. For more information, see Specifying Paths.

  • samples ‧ Specifies the number of sample points along a path for which to return elevation data. The samples parameter divides the given path into an ordered set of equidistant points along the path.

Examples:

  • 2 elevation samples between two points:
.for_sampled_path_request(
    ElevationLocations::LatLngs(vec![
        // Denver, Colorado
        LatLng::try_from(dec!(40.714728), dec!(-73.998672)).unwrap(),
        // Death Valley, California
        LatLng::try_from(dec!(-34.397), dec!(-116.866667)).unwrap(),
    ]),
    // Number of samples
    2
)
  • 4 elevation samples along a polyline:
.for_sampled_path_request(
    ElevationLocations::Polyline(String::from("gfo}EtohhUxD@bAxJmGF")),
    // Number of samples
    4
)

impl<'a> Request<'a>[src]

pub fn get(&mut self) -> Result<Response, Error>[src]

Performs the HTTP get request and returns the response to the caller.

Arguments:

This method accepts no arguments.

impl<'a> Request<'a>[src]

pub fn new(client_settings: &mut ClientSettings) -> Request[src]

Initializes the builder pattern for a Elevation API query with the required, non-optional parameters.

Arguments:

  • key - Your application's Google Cloud API key.

impl<'a> Request<'a>[src]

pub fn validate(&mut self) -> Result<&'a mut Request, Error>[src]

Ensures the built query is valid. This function checks the combination of parameters to ensure that they make sense together and that Google Maps Directions API will accept them - i.e. it will not allow both a Positional Request and a Sampled Path Request in the same query. This function does not check parameter values for validity - i.e. it will not ensure Polylines or Latitudes/Longitudes are valid and well-formed.

Arguments:

This method accepts no arguments.

Trait Implementations

impl<'a> Debug for Request<'a>[src]

impl<'a> PartialEq<Request<'a>> for Request<'a>[src]

impl<'a> PartialOrd<Request<'a>> for Request<'a>[src]

impl<'a> StructuralPartialEq for Request<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Request<'a>

impl<'a> Send for Request<'a>

impl<'a> Sync for Request<'a>

impl<'a> Unpin for Request<'a>

impl<'a> !UnwindSafe for Request<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,