[Blog] Closures: Magic Functions


I made a blog post explaining how closures are desugared and how they operate because I found quite a few questions here on users related to closures.


This is a great explanation of how closures work!

One critique of your blog: it’s not always clear which Playground link goes with which code block. You’ve got

some(code, version_1)

An explanation of how the code is structured, what it means, and how it relates to Closures: The Magic Functions.

The explanatory text can be long, sometimes enough that you can even end up scrolling a complete screen-full.

Playground Link

some(code, version_2)

Some more explanatory paragraphs about some code version 2 and how it is interesting and complicated.

It’s not clear whether the Playground Link goes with version_2, which it’s physically closer to, or version_1, which it is in the same logical section as because of the dividing line.

1 Like

Ok, I’ll annotate them. Thank you for the feedback!




Otherwise, good post! The rules around when closures act certain ways can be confusing, so it’s nice to see them laid out so clearly.

1 Like

Glad we also covered it in our Vancouver Rust Meetup


Incredible post!
I found this very illuminating, while also short and concise.

1 Like