Skip to content
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

allow warp::path!() call with no arguments #696

Merged
merged 4 commits into from
Jun 4, 2021

Conversation

utkarshkukreti
Copy link
Contributor

This is a feature request + implementation for it. Let me know if you think this is a bad idea.


It is equivalent to warp::path::end(). This is useful to have some symmetry
when defining multiple routes with path!:

warp::path!().map(|| 0)
.or(warp::path!("add" / u32 / u32).map(|a, b| a + b))
.or(warp::path!("mul" / u32 / u32).map(|a, b| a * b))

It is equivalent to `warp::path::end()`. This is useful to have some symmetry
when defining multiple routes with `path!`:

```
warp::path!().map(|| 0)
.or(warp::path!("add" / u32 / u32).map(|a, b| a + b))
.or(warp::path!("mul" / u32 / u32).map(|a, b| a * b))
```
@utkarshkukreti
Copy link
Contributor Author

Rebased!

@masklinn
Copy link
Contributor

FWIW I had this exact same need / request recently. I replaced the not-working path!() call by an end() but it feels unclear and icky.

@jxs jxs merged commit a337daf into seanmonstar:master Jun 4, 2021
@jxs
Copy link
Collaborator

jxs commented Jun 4, 2021

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants