geo-uri-rs
A Rust crate for uniform resource identifiers for geographic locations (geo URIs) according to IEEE RFC 5870. This crate supports parsing and generating geo URIs in the correct format. Its parser is currently somewhat more liberal than the proposed standard.
It supports geolocations specified by latitude and longitude, but also optionally altitude and an uncertainty radius. The currently only supported coordinate reference system is WGS-84.
Usage
Just run the following to add this library to your project:
Parsing
Use either the FromStr or
TryFrom traits to parse a geo URI string:
use GeoUri;
let geo_uri = try_from.expect;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
use FromStr;
let geo_uri = from_str.expect;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
It is also possible to call the parse function directly:
use GeoUri;
let geo_uri = parse.expect;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Generating
Use the GeoUriBuilder to construct a GeoUri struct.
Then, use either the ToString or
Display trait to generate an geo URI string:
use GeoUri;
let geo_uri = builder
.latitude
.longitude
.uncertainty
.build
.unwrap;
assert_eq!;
assert_eq!;
License
geo-uri-rs is licensed under the MIT license (see the LICENSE file or
http://opensource.org/licenses/MIT).