Conversation
|
Hey there! I think this looks reasonable, from a quick first glance:
One perf note is that it might be faster to do the replace, then figure out if we replaced anything, instead of looking for the match and then replacing. The docs say:
That being said: I'm just guessing (and that's not a good basis for requesting a perf change!) that it'd be faster to do a replace and then check if the result is Borrowed or Owned, instead of doing a match and then conditionally a replace, so maybe just a comment that we could consider benchmarking this in the future would be fine. Basically suggesting: // instead of this:
if is_match() {
replace()
}
// this
let res = replace()
if !res.is_borrowed() {
// set the new URI here
} |
jamesmunns
left a comment
There was a problem hiding this comment.
Made some nits, the one blocker is that I'd like to see the docs updated, then we can merge this!
|
My 2 cents about performance Doing So removing capture group would switch if !res.is_borrowed() {
// set the new URI here
}I feel here more readable would be |
Wrote a very simple and basic Url Rewrite functionality.
With the test configuration I tested doing:
http://localhost:8080/rewrite/blog/
Hope this could be the beginning of a contribution to this project, any feedback or improvements please let me know.
Thanks!