rust-transit / gtfs-structure

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

Allow Calendar, Shape, Route, and other enums to be clonable, move serde bounds, upgrade from deprecated time function #162

Closed kylerchin closed 5 months ago

kylerchin commented 5 months ago

I wanted to clone Vec to do some analysis on geodesics, and then I realised it wasn't implemented. This should not increase runtime, but does increase the binary size slightly as well as compile time. I think this is a useful feature since users of this library may need to clone these structures for analysis.

kylerchin commented 5 months ago

I've moved the bounds for serde from the predicate to where, so that the compiler evaluates them together, which produces exactly the same bounds.

The function Duration::days is now depreciated, and chrono::TimeDelta::try_days(days_offset) is preferred but produces an Option. This safely unwraps and only inserts days which are correct.

Merci d'avoir pris en compte les changements !