• 1 Post
  • 17 Comments
Joined 3 years ago
cake
Cake day: May 24th, 2021

help-circle










  • 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.






  • I disagree. Async Rust is fine, but it does have some baggage, not least of which is Pin/Unpin which I still don’t fully understand. But that aside, I prefer writing async Rust to any other language because the rest of Rust comes along for the ride!

    It’s actually amazing that I can use the same mental model for async code on a small MCU or a large server.

    Is Arc really the worst GC? Doesn’t Swift use reference counting also? I did a few minutes of searching but couldn’t really find any benchmarks comparing Arc with Swift RC or some other GC.

    I feel that async Rust is a good set of tradeoffs that allows it to scale to a lot more than just writing web servers. Rust seems to be pretty good for web servers too though.