tokio-rs / doc-push

Tokio doc blitz effort - A concerted effort to improve Tokio's documentation.
MIT License
50 stars 7 forks source link

Some interesting examples (may be should include some thing similar to current docs). #90

Open goriunov opened 5 years ago

goriunov commented 5 years ago

I have been searching around for some more examples about tokio and found this book it is incomplete but it gives quite a good examples which explain some abstractions.

I understood better some things about tokio when i looked in to some examples from above guide.

For instance i have checked this tutorial where it creates an incoming() method but with futures instead of the just calling incoming() from TcpListener. And after seen this example it is much clear how tokio's incoming() works on background and how i can write the same with futures.

Before that reading that part it was a bit hard to understand what tokio does and how it works with incoming part.

The same for read and write from this guide. It kind of explains quite a bit.

I think it would be very useful for beginners to see what was abstracted with tokio and how would it look without using tokio's helpers and abstractions as it will explain a lot of things.

Those docs are outdated and incomplete (would be really good to have them completed) so i needed to go to tokio's docs and find an alternative to accept() which is poll_accept() then change Async::Done((_, peer)) to Async::Ready and so on. And it is for the person who already understands somethings , where to search and what is outdated and what is not (this would be very hard for people who sees that stuff for the first time).