Open
Description
One topic I see new people hit pretty early on is the capturing semantics and the Fn*
traits.
I was thinking of adding a few lessons to show:
- Capturing semantics without
move
- Capturing semantics with
move
(including ie. binding a reference to a variable before using it in the closure and a reference is moved) - How the
Fn*
traits are auto-implemented. - Briefly mention that async block capturing is similar to closure capturing, but that there is no
Fn*
traits for async-block-futures.
I wanted to read the room a bit before actually putting time into this. Do we think this might be a bit too advanced for rustlings? Would it depend on the actual content? Would anyone be willing to help review my lessons to try and get it over the finish line?
It's an issue I get asked about constantly, especially when dealing with GUI frameworks like egui that make use of lots of nested closures... it might help people intuit these issues more clearly.
Let me know what you think!