An open API service indexing awesome lists of open source software.

https://github.com/traines-source/motis-nigiri-rust

A Rust wrapper around motis-project/nigiri
https://github.com/traines-source/motis-nigiri-rust

Last synced: 4 months ago
JSON representation

A Rust wrapper around motis-project/nigiri

Awesome Lists containing this project

README

          

# Rust wrapper for MOTIS / Nigiri
This is a Rust wrapper for the [Nigiri core](https://github.com/motis-project/nigiri) (currently [this fork](https://github.com/traines-source/nigiri)) of the [MOTIS project](https://motis-project.de). 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.

1. Run `nigiri-sys/build-docker.sh` once. This currently probably only works on Linux. For other platforms, adapt the `nigiri-sys/build-docker.sh` or try to run `nigiri-sys/build.sh` directly on your machine. If you already have `nigiri` checked out on your machine, before running, you may want to symlink it to the `nigiri-sys` directory 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 into `nigiri-sys/nigiri` and check out the `abi-journeys` branch. It will take some time to build `nigiri`.
2. Afterwards, you should be able to build the Rust crates (`nigiri-sys` and `motis-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 run `build-docker.sh` in 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.