#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

#86 in #location

Download history 742/week @ 2024-11-22 914/week @ 2024-11-29 1053/week @ 2024-12-06 997/week @ 2024-12-13 230/week @ 2024-12-20 136/week @ 2024-12-27 778/week @ 2025-01-03 645/week @ 2025-01-10 593/week @ 2025-01-17 770/week @ 2025-01-24 797/week @ 2025-01-31 819/week @ 2025-02-07 828/week @ 2025-02-14 1203/week @ 2025-02-21 928/week @ 2025-02-28 483/week @ 2025-03-07

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