usher
usher copied to clipboard
Investigate a builder interface for routers
Originally I felt this was unnecessary, but the currently implementation lends itself well to a builder as there are several advantages of a final build()
call.
- We can drop all
Parser
structures, because they're no longer needed. - We can compress all internal memory, as it's a guaranteed size (so e.g. shrink maps/vectors)`.
- We can avoid
Box<Parser>
at creation time and use a generic list structure.
It also lends itself better to customization in future - the types behind the builder can be out of the public API (and documented as such). This allows us to change various types ourselves, and return a Router<_>
.