rust-transit / gtfs-structure

Read a GTFS file
MIT License
56 stars 32 forks source link

Add ability to read transfers.txt #116

Closed zandemax closed 2 years ago

zandemax commented 2 years ago

As mentioned in #115, it would be great to process the transfers.txt from the GTFS spec.

For this, I have added:

I would appreciate your comments and feedback on this PR, and thanks already for your time and work on this library!

zandemax commented 2 years ago

Thanks for having a look and replying so quickly!

I didn't increase the version in cargo.toml yet, since i was not sure what your versioning/release process was like, but I incremented it now :)

Regarding the station/child problem, I think I would leave that up to the user of the library to implement, since as you said this depends on what you want to do in the end, but it is a good thing to consider!

I am currently working on a small project for which I am implementing a slightly modified version of RAPTOR, where I am using this library mostly for parsing GTFS and then turning it into my own representation for routing on. If you are curious I'd be happy to send you a link to the repo once I release it, currently its still in a bit of an early stage, e.g. missing transfers :)

Tristramg commented 2 years ago

Thank you for all the possible leads, and sorry that I hadn’t have a deeper look into what my suggestion implied :sweat_smile:

I was a bit busy. I will dig into it to have a more informed opinion

zandemax commented 2 years ago

No worries! I also wasn't quite aware of it until I tried to implement it :)

Tristramg commented 2 years ago

Hello,

I discussed with @antoine-de and you are completely right about the mutability hell introduced by Arc. However, we are not fond of introducing unsafe code just for this, and the third version is too cumbersome.

So let’s merge the way you did it, as it will actually be helpful.

We will explore a bit radical solution using things like https://docs.rs/generational-arena/0.2.8/generational_arena/ Let’s see where that brings us, maybe nowhere, maybe it will solve the problems with the translations #74 . And in any case its fun to try out approaches used for video games.

zandemax commented 2 years ago

Sounds good to me, I'm also not a big fan of introducing unsafe or RefCells here.

The library you linked sounds also very interesting, thanks for pointing it out!