rust-transit / gtfs-structure

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

Implement `Clone` for `Trip` #118

Closed meszarosdezso closed 2 years ago

meszarosdezso commented 2 years ago

This implements the Clone trait for the Trip struct (and thus for Frequency and StopTime too).

I am working on a project where I need to have an owned trip from the database, but since it was not clone-able I could only get a reference.

example code:

let trip: Trip = gtfs.trips.get("TRIP_ID").unwrap().clone();

before: error: expected Trip, found &Trip

after: compiles

Added a basic regression test.