Struct OpencageResponse

Source
pub struct OpencageResponse<T>
where T: Float,
{ pub documentation: String, pub licenses: Vec<HashMap<String, String>>, pub rate: Option<HashMap<String, i32>>, pub results: Vec<Results<T>>, pub status: Status, pub stay_informed: HashMap<String, String>, pub thanks: String, pub timestamp: Timestamp, pub total_results: i32, }
Expand description

The top-level full JSON response returned by a forward-geocoding request

See the documentation for more details

 {
   "documentation": "https://opencagedata.com/api",
   "licenses": [
     {
       "name": "CC-BY-SA",
       "url": "http://creativecommons.org/licenses/by-sa/3.0/"
     },
     {
       "name": "ODbL",
       "url": "http://opendatacommons.org/licenses/odbl/summary/"
     }
   ],
   "rate": {
     "limit": 2500,
     "remaining": 2499,
     "reset": 1523318400
   },
   "results": [
     {
       "annotations": {
         "DMS": {
           "lat": "41° 24' 5.06412'' N",
           "lng": "2° 7' 43.40064'' E"
         },
         "MGRS": "31TDF2717083684",
         "Maidenhead": "JN11bj56ki",
         "Mercator": {
           "x": 236968.295,
           "y": 5043465.71
         },
         "OSM": {
           "edit_url": "https://www.openstreetmap.org/edit?way=355421084#map=17/41.40141/2.12872",
           "url": "https://www.openstreetmap.org/?mlat=41.40141&mlon=2.12872#map=17/41.40141/2.12872"
         },
         "callingcode": 34,
         "currency": {
           "alternate_symbols": [

           ],
           "decimal_mark": ",",
           "html_entity": "&#x20AC;",
           "iso_code": "EUR",
           "iso_numeric": 978,
           "name": "Euro",
           "smallest_denomination": 1,
           "subunit": "Cent",
           "subunit_to_unit": 100,
           "symbol": "€",
           "symbol_first": 1,
           "thousands_separator": "."
         },
         "flag": "🇪🇸",
         "geohash": "sp3e82yhdvd7p5x1mbdv",
         "qibla": 110.53,
         "sun": {
           "rise": {
             "apparent": 1523251260,
             "astronomical": 1523245440,
             "civil": 1523249580,
             "nautical": 1523247540
           },
           "set": {
             "apparent": 1523298360,
             "astronomical": 1523304180,
             "civil": 1523300040,
             "nautical": 1523302080
           }
         },
         "timezone": {
           "name": "Europe/Madrid",
           "now_in_dst": 1,
           "offset_sec": 7200,
           "offset_string": 200,
           "short_name": "CEST"
         },
         "what3words": {
           "words": "chins.pictures.passes"
         }
       },
       "bounds": {
         "northeast": {
           "lat": 41.4015815,
           "lng": 2.128952
         },
         "southwest": {
           "lat": 41.401227,
           "lng": 2.1284918
         }
       },
       "components": {
         "ISO_3166-1_alpha-2": "ES",
         "_type": "building",
         "city": "Barcelona",
         "city_district": "Sarrià - Sant Gervasi",
         "country": "Spain",
         "country_code": "es",
         "county": "BCN",
         "house_number": "68",
         "political_union": "European Union",
         "postcode": "08017",
         "road": "Carrer de Calatrava",
         "state": "Catalonia",
         "suburb": "les Tres Torres"
       },
       "confidence": 10,
       "formatted": "Carrer de Calatrava, 68, 08017 Barcelona, Spain",
       "geometry": {
         "lat": 41.4014067,
         "lng": 2.1287224
       }
     }
   ],
   "status": {
     "code": 200,
     "message": "OK"
   },
   "stay_informed": {
     "blog": "https://blog.opencagedata.com",
     "twitter": "https://twitter.com/opencagedata"
   },
   "thanks": "For using an OpenCage Data API",
   "timestamp": {
     "created_http": "Mon, 09 Apr 2018 12:33:01 GMT",
     "created_unix": 1523277181
   },
   "total_results": 1
 }

Fields§

§documentation: String§licenses: Vec<HashMap<String, String>>§rate: Option<HashMap<String, i32>>§results: Vec<Results<T>>§status: Status§stay_informed: HashMap<String, String>§thanks: String§timestamp: Timestamp§total_results: i32

Trait Implementations§

Source§

impl<T> Debug for OpencageResponse<T>
where T: Float + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for OpencageResponse<T>
where T: Float + Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Serialize for OpencageResponse<T>
where T: Float + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T> Freeze for OpencageResponse<T>

§

impl<T> RefUnwindSafe for OpencageResponse<T>
where T: RefUnwindSafe,

§

impl<T> Send for OpencageResponse<T>
where T: Send,

§

impl<T> Sync for OpencageResponse<T>
where T: Sync,

§

impl<T> Unpin for OpencageResponse<T>
where T: Unpin,

§

impl<T> UnwindSafe for OpencageResponse<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,