application
application copied to clipboard
Router: Have a routes collection interface & support in Tracy router panel
- Feature
- Documentation – No change needed, unless you want to mention it in the "Custom Router" chapter.
- BC break - no
Currently, the only way to have a collection of routes and have them displayed in the Tracy panel is to use the RouteList
class.
This PR generalizes this logic to allow developers to implement their own route collections maybe with some logic inside (the RouteList
is just a simple hashmap), maybe immutable (RouteList
is mutable), etc. It comes from our use case but I believe it could be useful for others, too.
- This PR introduces a new interface for route lists that extends
IteratorAggregate
(which is the easiest way to implement aTraversable
) and adds thegetModule()
method that is required by the Tracy panel. - Because of the way
RouteList
is implemented, it can implement this new interface without any changes. - And the last change is the
instanceof
typecheck in the Panel to display a routes collection.
Personally, I like this idea. :) :+1:
I dislike the getModule()
method onIRouteList
.
Well, it is required by the Panel. There's not much I can do about it. You could say the same about the RouteList itself where its sole purpose is to be printed by the panel.
I like it. Could we merge it, rebase it or close it?