rust-transit / gtfs-structure

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

Use Index<Stop> instead of Arc<Stop>: Id as integer #123

Open antoine-de opened 2 years ago

antoine-de commented 2 years ago

POC to see if the ergonomics are ok or not

linked a bit to https://github.com/rust-transit/gtfs-structure/pull/116#issuecomment-1048780292

Remove Arc<Stop> in favor of Index<Stop> in StopTimes

This has the downside of needing the whole gtfs structure to access the stop's fields, but now we can have a mutable model easily.

let stop = gtfs.stops.get(stop_time.stop)?;

I'd like to try migrating a lib using gtfs_structures (maybe gtfs-to-geojson) to check this, but I open this draft to see if anyone has thoughts/ideas about this.

One down side of this is that I used https://gitlab.com/tekne/typed-generational-arena that is not very active (but it's so nice to have typed index :heart_eyes_cat: )

antoine-de commented 2 years ago

after having given thought about this, I think the generational_area is overkill here, a typed index on a map would be enough and more convenient to use no ? I'll open a new draft with this I think