Rust wrapper for MOTIS / Nigiri
April 13, 2024 ยท View on GitHub
This is a Rust wrapper for the Nigiri core (currently this fork) of the MOTIS project. It enables retrieving static and realtime timetable data from the various formats (e.g. GTFS/GTFS-RT) parsed by Nigiri. The nigiri-sys crate provides the raw, unsafe bindings, while the motis-nigiri crate in the root of this repository provides a safe wrapper with an abstracted API.
Building
It is currently not possible to completely build these crates in the Cargo build lifecycle. You will need Docker and/or the necessary build dependencies installed locally.
- Run
nigiri-sys/build-docker.shonce. This currently probably only works on Linux. For other platforms, adapt thenigiri-sys/build-docker.shor try to runnigiri-sys/build.shdirectly on your machine. If you already havenigirichecked out on your machine, before running, you may want to symlink it to thenigiri-sysdirectory or adapt the build script. Note that as long as patches to nigiri are not merged upstream, you should manually clone https://github.com/traines-source/nigiri intonigiri-sys/nigiriand check out theabi-journeysbranch. It will take some time to buildnigiri. - Afterwards, you should be able to build the Rust crates (
nigiri-sysandmotis-nigiri, which depends on the former) or depending crates as usual (cargo build). This requires glibc 2.34 and possibly some other C/C++ stdlib dependencies installed on your machine. Alternatively, you can runbuild-docker.shin the root of this repository.
Using
Note that when using the raw nigiri-sys bindings you must always call the respective *_destroy_* functions when done, otherwise memory will be leaked. When using motis-nigiri, this is done automatically when the respective structs are dropped.