Earlier quoted context omitted.
Would it be fair to compare this to Apple's Grand Central Dispatch a.k.a. libdispatch?
To me it's kind of like the event loop of node.js (which I believe comes from libuv)?
Tokio 1.0 – async runtime for Rust
21–30 of 422 posts
Re: Tokio 1.0 – async runtime for Rust
#22Earlier quoted context omitted.
The Rust language provides the async/await syntax, which can turn imperative code into Future objects, but to run those Future objects, you must repeatedly call their poll method. Tokio is the piece of code that calls that method. It does so in a manner such that futures are only polled if able to continue work, and not e.g. waiting for a timer. Besides that it provides lots of utilities for working with async code.
Would it be fair to compare this to Apple's Grand Central Dispatch a.k.a. libdispatch?
Re: Tokio 1.0 – async runtime for Rust
#23Can someone explain to a non-rustacean what Tokio introduces that's not part of Rust? It looks like Rust provides the async/await semantics, so I'm guessing this is an event loop and dispatching system?
The community prefers the term "rustacean" to be as inclusive as possible. Please keep that in mind in the future.
Re: Tokio 1.0 – async runtime for Rust
#24Congrats! I've fallen off Rust due to pivoting at work plus trying other languages but I'm intrigued again by Tokio's announcement. I'll be trying out your tutorial soon!
what did you pivot to and why, if you don't mind me asking?
I'd honestly like to know too.
Re: Tokio 1.0 – async runtime for Rust
#25Earlier quoted context omitted.
Replying to myself, I found this bit in the docs explaining how Tokio decorates the main: > An async fn is used as we want to enter an asynchronous context. However, asynchronous functions must be executed by a runtime. The runtime contains the asynchronous task scheduler, provides evented I/O, timers, etc.
To provide some more color on why this isn't built in, different runtimes provide different kinds of guarantees and performance profiles. A webapp has very different requirements than an embedded system, and so we don't want to provide a single runtime. The language contains the basic things needed for the ecosystem to exist, and interoperation points, and then leaves the rest to said ecosystem. (Some of those intero…
Re: Tokio 1.0 – async runtime for Rust
#26What would be Tokios equivalent in .net/C# ?
Re: Tokio 1.0 – async runtime for Rust
#27Can someone explain to a non-rustacean what Tokio introduces that's not part of Rust? It looks like Rust provides the async/await semantics, so I'm guessing this is an event loop and dispatching system?
> rustafarian The community prefers the term "rustacean" to be as inclusive as possible. Please keep that in mind in the future.
Re: Tokio 1.0 – async runtime for Rust
#28Earlier quoted context omitted.
To provide some more color on why this isn't built in, different runtimes provide different kinds of guarantees and performance profiles. A webapp has very different requirements than an embedded system, and so we don't want to provide a single runtime. The language contains the basic things needed for the ecosystem to exist, and interoperation points, and then leaves the rest to said ecosystem. (Some of those intero…
As always, very elegant. Thanks for the added info.
If you want to dig deeper:
Re: Tokio 1.0 – async runtime for Rust
#29Re: Tokio 1.0 – async runtime for Rust
#30Earlier quoted context omitted.
Replying to myself, I found this bit in the docs explaining how Tokio decorates the main: > An async fn is used as we want to enter an asynchronous context. However, asynchronous functions must be executed by a runtime. The runtime contains the asynchronous task scheduler, provides evented I/O, timers, etc.
To provide some more color on why this isn't built in, different runtimes provide different kinds of guarantees and performance profiles. A webapp has very different requirements than an embedded system, and so we don't want to provide a single runtime. The language contains the basic things needed for the ecosystem to exist, and interoperation points, and then leaves the rest to said ecosystem. (Some of those intero…