-
-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wrap_fn #693
Add wrap_fn #693
Conversation
hey @jxs this PR looks really interesting! I've loosely followed the referenced issue, I'm especially interested in the use case underlined by this comment, i.e. having the capability of making multi-step filters easier to write and follow. How could this patch help in that regard? I can try hacking something when this PR gets merged, but I would love a more explicit (perhaps real world) example of usage. Thanks! |
@apiraino i am going to merge this so as it becomes available and the issue can be closed, but the example can always be improved after as we discussed in discord |
yes please! 👍 I didn't mean to block the merge, I'll try figuring that out as my time allows (couldnt make a good example quickly) |
Is there a good way to represent these pub fn my_custom_wrapper<F>() -> impl warp::Wrap<F>
where
F: Filter,
F::Extract: ...,
{
warp::wrap_fn(|filter| ...)
} To be used with: warp::path(...).with(my_custom_wrapper()) This currently isn't possible yet due to the fact that |
@cutsoy it should be fn my_custom_wrapper<F, T>(
filter: F,
) -> impl Filter<Extract = (&'static str,)> + Clone + Send + Sync + 'static
where
F: Filter<Extract = (T,), Error = std::convert::Infallible> + Clone + Send + Sync + 'static,
F::Extract: warp::Reply,
{
...
}
warp::path(...).with(wrap_fn(my_custom_wrapper())) take a look at the wrapping example for more details |
No description provided.