pub struct Response {
pub snapped_points: Vec<SnappedPoint>,
pub warning_message: Option<String>,
pub error: Option<ErrorResponse>,
}Expand description
The response from the Google Maps Nearest Roads request will be stored in this structure.
§Nearest Roads Responses
For each valid request, the Roads API will return a response in the format indicated within the request URL such as the following JSON response.
Fields§
§snapped_points: Vec<SnappedPoint>An array of snapped points. See SnappedPoint for more information.
warning_message: Option<String>A string containing a user-visible warning.
error: Option<ErrorResponse>In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status.
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 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.