usher icon indicating copy to clipboard operation
usher copied to clipboard

Investigate a builder interface for routers

Open whitfin opened this issue 5 years ago • 0 comments

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<_>.

whitfin avatar Apr 05 '19 18:04 whitfin