#distance #implemented #location

haversine

haversine implemented in rust

2 releases

Uses old Rust 2015

0.2.1 Sep 6, 2015
0.2.0 Jun 26, 2015

#75 in #location

Download history 526/week @ 2024-03-25 501/week @ 2024-04-01 523/week @ 2024-04-08 644/week @ 2024-04-15 736/week @ 2024-04-22 543/week @ 2024-04-29 492/week @ 2024-05-06 621/week @ 2024-05-13 726/week @ 2024-05-20 692/week @ 2024-05-27 857/week @ 2024-06-03 705/week @ 2024-06-10 818/week @ 2024-06-17 629/week @ 2024-06-24 687/week @ 2024-07-01 625/week @ 2024-07-08

2,769 downloads per month

MIT license

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));
}

No runtime deps