hrdf_routing_engine/
lib.rs

1mod debug;
2mod isochrone;
3mod routing;
4mod service;
5mod utils;
6
7pub use isochrone::compute_isochrones;
8pub use routing::find_reachable_stops_within_time_limit;
9pub use routing::plan_journey;
10pub use routing::Route;
11pub use routing::RouteSection;
12
13use std::{env, error::Error};
14
15use debug::run_debug;
16use hrdf_parser::{Hrdf, Version};
17use service::run_service;
18
19pub async fn run() -> Result<(), Box<dyn Error>> {
20    let hrdf = Hrdf::new(
21        Version::V_5_40_41_2_0_5,
22        "https://opentransportdata.swiss/en/dataset/timetable-54-2024-hrdf/permalink",
23        false,
24    )
25    .await?;
26
27    let args: Vec<String> = env::args().collect();
28
29    if args.get(1).map(|s| s.as_str()) == Some("serve") {
30        run_service(hrdf).await;
31    } else {
32        run_debug(hrdf);
33    }
34
35    Ok(())
36}