#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

#74 in #location

Download history 748/week @ 2024-07-24 1222/week @ 2024-07-31 1176/week @ 2024-08-07 708/week @ 2024-08-14 720/week @ 2024-08-21 500/week @ 2024-08-28 641/week @ 2024-09-04 637/week @ 2024-09-11 455/week @ 2024-09-18 490/week @ 2024-09-25 351/week @ 2024-10-02 494/week @ 2024-10-09 667/week @ 2024-10-16 709/week @ 2024-10-23 726/week @ 2024-10-30 802/week @ 2024-11-06

3,014 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