pub struct Response {
pub dst_offset: Option<i32>,
pub error_message: Option<String>,
pub raw_offset: Option<i32>,
pub status: Status,
pub time_zone_id: Option<Tz>,
pub time_zone_name: Option<String>,
}Expand description
The response from the Google Maps Time Zone API will be stored in this structure.
§Time Zone Responses
For each valid request, the time zone service will return a response in the format indicated within the request URL.
The local time of a given location is the sum of the timestamp parameter, and the dstOffset and rawOffset fields from the result.
Fields§
§dst_offset: Option<i32>The offset for daylight-savings time in seconds. This will be zero if
the time zone is not in Daylight Savings Time during the specified
time.
error_message: Option<String>More detailed information about the reasons behind the given status
code, if other than OK.
Note: This field is not guaranteed to be always present, and its content is subject to change.
raw_offset: Option<i32>The offset from UTC (in seconds) for the given location. This does not take into effect daylight savings.
status: StatusThe status of the response.
time_zone_id: Option<Tz>A string containing the ID of the time zone, such as
America/Los_Angeles or Australia/Sydney. These IDs are defined by
Unicode Common Locale Data Repository (CLDR)
project, and currently available in file
timezone.xml.
When a timezone has several IDs, the canonical one is returned. In
timezone.xml, this is the first rename of each timezone. For example,
Asia/Calcutta is returned, not Asia/Kolkata.
time_zone_name: Option<String>A string containing the long form name of the time zone. This field will be localized if the language parameter is set. eg. “Pacific Daylight Time” or “Australian Eastern Daylight Time”
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Response> for Result<Response, Error>
impl From<Response> for Result<Response, Error>
Source§fn from(response: Response) -> Self
fn from(response: Response) -> Self
Converts a Google Maps API Response into a Result<Response, Error>
by examining the status field inside of the response.
If the status indicates a success, then an Ok(response) will be
returned. If the status indicates an error, then an Err(error) will be
returned.
Source§impl FromStr for Response
impl FromStr for Response
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Converts a Google Maps API JSON
&str response into a Response struct.
§Notes
-
It’s recommended to use the implemented
TryFromtrait instead. -
The serde_json’s
from_strfunction implementation is unsafe and it’sfrom_slicefunction requires a mutable reference. Therefore this trait clones the&strinto aStringto givefrom_slicemutable access to the string.
impl Eq for Response
impl StructuralPartialEq for Response
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.