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

pub struct Request { /* fields omitted */ }

Use this structure's methods to build your Time Zone API request.

Methods

impl Request[src]

pub fn build(&mut self) -> &mut Request[src]

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

Arguments:

This method accepts no arguments.

impl Request[src]

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

Executes the query you've built.

Description:

You are not required to call the .validate()?.build()?.get()? chain at the end of your builder pattern. You may still wish to do so if you would like to manually control the method calls. For example, if you would like to omit validation. However, this .execute() method wraps all of these steps into a single method call for convenience.

Arguments:

This method accepts no arguments.

impl Request[src]

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

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

Arguments:

This method accepts no arguments.

impl Request[src]

pub fn new(key: String, location: LatLng, time: PrimitiveDateTime) -> Request[src]

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

Arguments:

  • key - Your application's Google Cloud API key.
  • location - Latitude & longitude of the desired time zone location.
  • time - Time is used to determine if Daylight Savings is applicable.

Example:

let time_zone = Request::new(
    // St. Vitus Cathedral in Prague, Czechia
    LatLng { lat: 50.090903, lng: 14.400512 },
    PrimitiveDateTime::new(
        // Tuesday February 15, 2022
        Date::try_from_ymd(2022, 2, 15).unwrap(),
        // 6:00:00 pm
        Time::try_from_hms(18, 00, 0).unwrap(),
    ),
    // Your Google API Key
    GOOGLE_API_KEY,
// Build query string and then perform HTTP get request
).build().get();

impl Request[src]

pub fn with_language(&mut self, language: Language) -> &mut Request[src]

Adds the language parameter to the Time Zone API query.

Arguments:

  • language ‧ The language that Google's response should be presented in.

Example:

  • Set Google's response to the French language:
.with_language(Language::French)

Trait Implementations

impl Clone for Request[src]

impl Debug for Request[src]

Auto Trait Implementations

impl RefUnwindSafe for Request

impl Send for Request

impl Sync for Request

impl Unpin for Request

impl UnwindSafe for Request

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.