I read the docs but I don't understand why futures and how it works..
It will be better if u will First create synchronous code then turn that into asynchronous code with futures
I read the docs but I don't understand why futures and how it works..
It will be better if u will First create synchronous code then turn that into asynchronous code with futures
I find that this article can be good at giving an initial understanding of how it works. Also, which docs did you read? Did you read the Tokio tutorial?
Yes.
Can u pls provide example with a
synchronous code and turn that into async code with Futures..no async keyword
No async keyword? Using async/await is an important part of async programming.
Assuming you just want more insight into how the Future trait works and might be implemented manually, I have constructed a playground which shows an example of using Futures without the async/await sugar:
This example runs some "timers" concurrently on a single thread.
This example has a number of "gotchas" due to it's simplicity:
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.