[][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.

Example:

let time_zone = Request::new(
    // Eiffel Tower in Paris, France
    LatLng { lat: 48.858379, lng: 2.294481 },
    PrimitiveDateTime::new(
        // Wednesday June 4, 2025
        Date::try_from_ymd(2025, 6, 4).unwrap(),
        // 8:30:00 am
        Time::try_from_hms(8, 30, 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 execute(&mut self) -> Result<Response, Error>[src]

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:

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

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 the response will be presented in.

Example:

let time_zone = Request::new(
    // Monument to the Battle of the Nations in Leipzig, Germany
    LatLng { lat: 51.312378, lng: 12.413269 },
    PrimitiveDateTime::new(
        // Saturday October 5, 2024
        Date::try_from_ymd(2024, 10, 5).unwrap(),
        // 1:30:00 pm
        Time::try_from_hms(13, 30, 0).unwrap(),
    ),
    // Your Google API Key
    GOOGLE_API_KEY,
// Set Google's response to the French language
).with_language(Language::French)
// Build query string and then perform HTTP get request
.build().get();

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.

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