This topic continues actix/actix-web#2858 , whole goal is to .wrap an optional middleware. Condition middleware exists but requires a transformer even when unused. It seems to me that using an Option is more natural. But as that PR was on a different crate than Transform's, a newtype was introduced, and .into() required an explicit annotation. Sadly this was non-optimal.
@fakeshadow suggested that this feature should rather be moved into Transform's crate, so that .wrap can natively take an Option<SomeMiddleware>. This would mean moving the ConditionMiddleware code too.
This topic continues actix/actix-web#2858 , whole goal is to
.wrapan optional middleware.Conditionmiddleware exists but requires a transformer even when unused. It seems to me that using anOptionis more natural. But as that PR was on a different crate thanTransform's, a newtype was introduced, and.into()required an explicit annotation. Sadly this was non-optimal.@fakeshadow suggested that this feature should rather be moved into
Transform's crate, so that.wrapcan natively take anOption<SomeMiddleware>. This would mean moving theConditionMiddlewarecode too.