The Collectionand Idx are really great to have lots of statically checked stuff.
The transit model has a lot of links between the objects, and for the moment all those links are Strings.
I think navitia_model could be even better if those String ids were also typed.
For example the stop_area_id in the StopPoint could be a Identifier<StopArea> instead of a String.
We could then also remove the get_idx/get method in CollectionWithId<T> to take an &Identifier<T> instead of a &str.
We would also need to find a nice name for this identifier. I don't think we can use the obvious Id because it's already a Trait. Identifier ? Link ? TypedId ? TId ? any other thing ? another option would be to rename the Id trait (maybe to HasId ?)
What do you think ?
The
CollectionandIdxare really great to have lots of statically checked stuff.The transit model has a lot of links between the objects, and for the moment all those links are
Strings.I think
navitia_modelcould be even better if thoseStringids were also typed.For example the
stop_area_idin theStopPointcould be aIdentifier<StopArea>instead of aString.We could then also remove the
get_idx/getmethod inCollectionWithId<T>to take an&Identifier<T>instead of a&str.We would also need to find a nice name for this identifier. I don't think we can use the obvious
Idbecause it's already aTrait.Identifier?Link?TypedId?TId? any other thing ? another option would be to rename theIdtrait (maybe toHasId?)What do you think ?