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

async/.await example #281

Open
wants to merge 4 commits into
base: master
from
Open

async/.await example #281

wants to merge 4 commits into from

Conversation

@alsuren
Copy link
Contributor

alsuren commented Oct 7, 2018

In a previous iteration of this PR, I noticed in another project that I was wanting to use try!() a lot, now that my code looked like sync code, so I made a handler_try!() macro. In this version of the PR, I just use nested async blocks. Both are a bit ugly. I'm not sure which is better.

It would be really nice if we could have an impl of Handler for async functions (it would let me collapse my fn _() {Box::new(async {}.boxed(...).compat())} boilerplate into async fn _() {...}). Not the end of the world though.

@alsuren alsuren force-pushed the alsuren:async-await branch from 89ade35 to 700b700 Oct 7, 2018
@colinbankier

This comment has been minimized.

Copy link
Collaborator

colinbankier commented Oct 23, 2018

@alsuren - thanks for sharing your work on this. Cool to see examples as async/await solidifies.

@alsuren alsuren force-pushed the alsuren:async-await branch from 700b700 to 23d2eef Nov 4, 2018
@alsuren alsuren force-pushed the alsuren:async-await branch from af7ffc6 to 04ca92e Nov 16, 2019
@alsuren alsuren changed the title WIP async/await example async/.await example Nov 16, 2019
@alsuren alsuren force-pushed the alsuren:async-await branch from 04ca92e to 309c89f Nov 16, 2019
@alsuren

This comment has been minimized.

Copy link
Contributor Author

alsuren commented Nov 16, 2019

I've basically rewritten this from scratch. I would say that it is ready for review now.

If you like this then I will try examples/handlers/form_urlencoded next.

@colinbankier

This comment has been minimized.

Copy link
Collaborator

colinbankier commented Nov 21, 2019

Thanks for your efforts here @alsuren 👍 .
I'm wondering if we should wait to see if #370 means we update gotham to use Futures 0.3 soon anyway, then these example don't need to bother with the compat stuff.
Nice to have some examples of how it can be done however and maybe Futures 0.3 will take longer than I'm hoping.

@alsuren alsuren mentioned this pull request Nov 21, 2019
0 of 12 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.