2 releases
Uses old Rust 2015
0.2.1 | Sep 6, 2015 |
---|---|
0.2.0 | Jun 26, 2015 |
#75 in #location
2,769 downloads per month
3KB
haversine
haversine implemented in rust
Add haversine dependency to your project Cargo.toml file:
[dependencies]
haversine = "0.2.1"
Example usage:
extern crate haversine;
use haversine::{distance, Location};
fn main() {
let start1 = haversine::Location{latitude: 38.898556,longitude: -77.037852};
let end1 = haversine::Location{latitude: 38.897147, longitude: -77.043934};
println!("{}", haversine::distance(start1, end1, haversine::Units::Miles));
let start2 = haversine::Location{latitude: 38.898556,longitude: -77.037852};
let end2 = haversine::Location{latitude: 38.897147, longitude: -77.043934};
println!("{}", haversine::distance(start2, end2, haversine::Units::Kilometers));
}