ibraheemdev / matchit

A high performance, zero-copy URL router.
https://docs.rs/matchit
MIT License
366 stars 37 forks source link

Support escaping '{' and '}' #51

Closed ibraheemdev closed 8 months ago

ibraheemdev commented 8 months ago

This is one of the last features I want to land as part of https://github.com/ibraheemdev/matchit/issues/35. It ended up being a lot more work than expected because of the way parameter normalizing/denormalizing works, but most of the new logic is contained within the Unescaped types during insertion, so search is unaffected.

This change also reworks InsertError to be more clear. InsertError::InvalidParamSegment now represents an error within a /.../ segment (i.e. multiple parameters/unsupported suffix), while InsertError::InvalidParam represents any other parameter syntax related error.