BLOG: Why choose async/await over threads? (notgull.net)
from snaggen@programming.dev to rust@programming.dev on 25 Mar 2024 14:58
https://programming.dev/post/11912202

#rust

threaded - newest

TheAgeOfSuperboredom@lemmy.ca on 25 Mar 2024 16:51 collapse

Finally some positivity around async Rust!

I write a lot of embedded C for a living, and can’t wait for the ecosystem to get better so I can switch to Rust. Threading always starts simple. All I need is to spawn a thread and wait for a message on a queue. Then requirements change and I’m waiting on multiple messages from multiple other threads and suddenly I’m writing yet another state machine that async Rust would write for me.

I also wish I had “coloured” functions in my embedded code. Often times it’s not even documented if a function blocks or not, and sometimes the behaviour changes depending on compile time configuration (blocking, or interrupt driven, or DMA, etc.).

Async Rust certainly has it’s complexity too, but at least to my brain it would make a lot of my code much simpler.

I need to find some time to really dig into Embassy one of these days.

stsquad@lemmy.ml on 25 Mar 2024 21:19 collapse

I’m looking at Embassy too for a Pico project and combining it with a nostd mqtt implementation. However I need to understand Futures and if/how they relate to the async paradigm.

TheAgeOfSuperboredom@lemmy.ca on 27 Mar 2024 02:23 collapse

Sounds fun! I assume you’re read the Async Book?

stsquad@lemmy.ml on 27 Mar 2024 06:18 collapse

I have not, but I will now thanks.