I'm trying to make my own middleware.
However, I am thinking of using wrap_fn because the method of creating middleware is difficult.
What is the clear difference between wrap and wrap_fn?
Also, will the performance be worse if I use wrap_fn?
I have already read that document.
Other than that, is there any difference, especially in terms of functionality?
If not, I would like to use wrap_fn.
The only difference worth mentioning is that of reusability. If you implement a middleware on a struct, you can use it in several routes throughout your application; if you implement it with a closure, it will only apply for that specific route.