3 ms·
Not exactly, no. There's a bit more ceremony since there isn't a GC, but that's a systems language for you. Closures are basically syntax sugar for a struct th
by steveklabnik 9y ago
Not exactly, no. There's a bit more ceremony since there isn't a GC, but that's a systems language for you.
Closures are basically syntax sugar for a struct that represents the environment, and a function pointer which takes that struct as one of its parameters. So you can do anything that you can do with that setup, aka, anything :)
https://doc.rust-lang.org/book/second-edition/ch13-01-closures.html https://doc.rust-lang.org/book/second-edition/ch13-01-closur...