-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
WIP: Rewrite examples with async
.
#1228
Conversation
170abc3
to
d842e5b
Compare
d842e5b
to
f2562db
Compare
I think these three examples are as far as it gets right now:
I'll still have a look at Everything else seems to fall in the above categories. |
|
|
Thanks for doing this work. re: let listener = TcpListener::bind(...)?;
loop {
let (socket, _) = listener.accept().await?;
// do something with the socket.
} I'll review the rest shortly. Thanks again. |
I updated the proxy example in the TCP split PR: link, but did not include it eventually. The usage of |
Instead of implementing Future manually, we can now make use of combinators and `async`.
547cdbc
to
015e1d3
Compare
Hmm, I have the commit now, but there's a lot of things going on that I'm afraid to touch without permission for
EDIT: cfr commit 4487254 |
You didn't mean to rewrite the Tcp examples with
|
@rubdos You are correct! I have a branch in progress, but I ended up going into a yak shave as the necessary tooling to write tests weren't in place yet. I will try to get that up today. |
Yeah, maybe it's not time yet. It can be adopted once the incoming/accept method is settled, and Also, feel free to come up with something entirely different. It's by no means the only way to write this example. |
I have posted #1242. |
Nice! Expect TCP examples coming in tonight! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to move forward with this as is. Follow up work can happen in new PRs. Thanks again 👍
Motivation
Solution
I started rewriting the examples using the new
#[tokio::main]
andasync
andawait
keywords. I will have every example in it's own commit, such that you can cherry pick what you'd like to keep.I'm on Gitter and IRC, so feel free to ping me there.