google_geocoding
A strongly-typed (a)synchronous Rusty API for the Google Geocoding API
Synchronous API (Basic)
The synchronous API is optimized for the ergonomics of common usage.
You can do a simple look up of coordinates from an address:
use geocode;
for coordinates in geocode.unwrap
Do a simple look up of an address from coordinates:
use ;
let coordinates = WGS84 try_new.unwrap;
for address in degeocode.unwrap
Note that it is recommended to use WGS84::try_new() as WGS84::new() will panic with invalid coordinates
The synchronous API provides the address or coordinates from the API reply. However, the full reply includes a great deal more information. For access to the full reply, see the lowlevel asynchronous API.
Synchronous API (Advanced)
The GeocodeQuery and DegeocodeQuery objects can be used for more complex lookups
use ;
let query = new
.language
.region;
for coordinates in geocode.unwrap
Asynchronous API
The Connection object provides access to the lowlevel async-based API.
Unlike the synchronous API, these functions provide the full API reply. You will therefore need to extract the specific information you want.
These functions are used to implement the Synchronous API described earlier.
extern crate google_geocoding;
extern crate tokio_core;
use Connection;
use Core;
const ADDRESS: &str = "1600 Amphitheater Parkway, Mountain View, CA";
let mut core = new.unwrap;
let core_handle = core.handle;
let geocode_future = new.geocode;
let reply = core.run.unwrap;
for candidate in reply
Notes
This is an unofficial library.
License: MIT