Crates.io | haversine |
lib.rs | haversine |
version | 0.2.1 |
source | src |
created_at | 2015-06-26 02:32:18.586891 |
updated_at | 2015-12-11 23:53:29.779383 |
description | haversine implemented in rust |
homepage | https://github.com/visualjeff/haversine |
repository | https://github.com/visualjeff/haversine.git |
max_upload_size | |
id | 2468 |
size | 3,774 |
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));
}