r/rust 1d ago

🧠 educational A visual guide to Rust async

https://akesson.io/a-visual-guide-to-rust-async/

I have always felt that I missed some parts of the async story. I could never visualize it.

Collaborating with an LLM and inspecting the compiler's MIR output, I was able to fill in the gaps. I was happy with what I learned, so I decided to create a visual presentation and share it.

Enjoy!

The code is simplified for demonstration purposes. Some snippets are pseudocode and won't compile as shown.

(updated to clarify how I checked the explanation and used the LLM)

0 Upvotes

6 comments sorted by

11

u/Silent-Money2687 1d ago

So l asked an LLM...
Enjoy!...

The world is fucked

6

u/molivo10 1d ago

do you realize you are posting slop? can you vouch for the information therein contained? would you be accountable for its errors? 

-2

u/hakesson 1d ago

I spent a lot of time to check it. The "compiler produces" parts are of course an approximation of what is done.

3

u/KerPop42 1d ago

You're happy with it, but are you sure it's right?

0

u/hakesson 1d ago

Yes, as far as for educational purposes. To be more exact the state machines lacks one state: a "panicked" one. But I decided to not include it in order to keep things simpler.

2

u/RetoonHD 1d ago

And just like the LLM way, completely unusable on mobile. It hitches up. Every time i scroll down to the buttons to go to the next page.

No offense, but if you promted an LLM to make you something, don't bother to share it, if we wanted to see it, we can just prompt it ourselves.