tokio-rs / doc-push

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

Futures `Hello World` example (same as in `Hello World!` section) #52

Open goriunov opened 6 years ago

goriunov commented 6 years ago

I have went trough the guide and noticed that we have Hello World! example which uses tokio directly with the tasks. Would be good to see exactly the same example but implemented with futures (stream) directly so people will be able to compare it and see what tokio does on background. I also went through the Futures section and it uses a little different example which is feels like completely separate thing and just confuses me more like why would.

I believe it would be good to see different ways of implementing the same things to understand how everything is related in this case (Futures (Stream), Tokio, Tasks)

goriunov commented 6 years ago

Would be actually good to have few examples which uses different approaches (more low and high levell)

carllerche commented 6 years ago

The example on this page? https://tokio.rs/docs/getting-started/futures/

Also, are you suggesting that there should be more examples that use combinators and then repeat the example by implementing Future directly?

goriunov commented 6 years ago

Also, are you suggesting that there should be more examples that use combinators and then repeat the example by implementing Future directly?

Yes, at least few examples (simple, intermediate) which would be implemented with combinators and re implemented exactly the same in futures. This will help to understand more how the system works (especially for beginners as it is very hard to find a reason for Futures and Combinators and how to use each of them and in which situation and how really Combinators work with Futures). I am still a beginner in Tokio so i may say somethings wrong.

That would be a good way to show actually how Tokio empower Futures. And as i mentioned it is mostly useful for Beginners.

carllerche commented 6 years ago

Thoughts @rylev ?

rylev commented 6 years ago

I agree that this would be useful though with the reworking of the Getting Started section in https://github.com/tokio-rs/website/pull/224 I don't think that Getting Started is the right place to do this. I think we should find a place to do this in the "Futures, Streams and Sinks" guide.

carllerche commented 6 years ago

We probably want to revisit the getting started examples in "Futures, Streams, and Sinks" to do the compare / contrast.