4 ms·
This is because of the removal of the fat runtime and green threads about 5 years ago. Since there was no blessed way to do high concurrency in the language any
by fzzzy 8y ago
This is because of the removal of the fat runtime and green threads about 5 years ago. Since there was no blessed way to do high concurrency in the language any more, some code started using normal threads, some code (tokio) started using normal callbacks. Callbacks in rust are tricky because of the type system. Around a year ago, async/await became possible due to the development of the Pin idea. async with the await! macro is usable now, but the rust community has been bikeshedding over built-in await syntax and last time I looked that discussion was still raging.
So you can write scalable servers using normal threads, normal callbacks, and async with the await! macro, but not the final async/await syntax because the community hasn’t even finished deciding what it is. Porting code between these approaches is also not particularily easy. I have seen example code for rust networking libraries that uses all of the different approaches, but mixing the different approaches is also difficult. So that’s probably why people say it’s not ready even though you can write code right now that will work just fine. The “final” way of writing it isn’t ready yet, and if you write one of the current forms, porting to the final form will be a pain.
- woah 8y agoPorting from futures to async shouldn’t be too hard based on my experience doing it in JS.
- fzzzy 8y agoSure, but js doesn’t have rust’s type system. It will probably be straightforward once everything is settled down, but right now Future 0.1 (tokio) and Future 0.3 (async/await) aren’t comptatible and you’ll find examples that use one or the other, or plain threads, or plain callbacks. It’s possible to get up and running quickly with the examples from various libraries, but when you try to mix them, if they use different styles, it becomes very challenging. Once async/await is finalized and everything moves to it this won’t be a problem, but that’s probably going to take at least a year or possibly years.
- pimeys 8y agoI did a test and converted one of my libraries to async/await and it was not that hard. There are easy converters between the future versions for the transition period. https://github.com/pimeys/a2/pull/30/files https://github.com/pimeys/a2/pull/30/files