2 releases

0.1.1 Jul 14, 2023
0.1.0 Jul 11, 2023

#72 in #location

Apache-2.0

41KB
512 lines

Rust API client for Valhalla

This crate contains the types and functions for interacting with the Valhalla API.

At the moment, only the routing API is implemented.

Examples

use valhalla_client::{Valhalla, Location, Manifest};;
let valhalla = Valhalla::default();

let manifest = Manifest {
    locations: vec![Location::new(4.9041, 52.3676), Location::new(5.1214, 52.0907)],
    costing: valhalla_client::Costing::Bicycle,
    ..Default::default()
};

let response = valhalla.route(manifest).unwrap();

println!("{:#?}", response);

// If the gpx feature is enabled, you can convert the response to a gpx::Gpx object
// let gpx = response.trip.into();

lib.rs:

This crate contains the types and functions for interacting with the Valhalla API.

At the moment, only the routing API is implemented.

Examples

use valhalla_client::{Valhalla, Location, Manifest};;
let valhalla = Valhalla::default();

let manifest = Manifest {
    locations: vec![Location::new(4.9041, 52.3676), Location::new(5.1214, 52.0907)],
    costing: valhalla_client::Costing::Bicycle,
    ..Default::default()
};

let response = valhalla.route(manifest).unwrap();

println!("{:#?}", response);

// If the gpx feature is enabled, you can convert the response to a gpx::Gpx object
// let gpx = response.trip.into();

Dependencies

~8–23MB
~341K SLoC