Closures get compiled down to anonymous structs which include their captures as the struct's fields.
That means a capturing closure
let x = 1i32;
let c = || println!("{x}");
c();Is compiled to[^1]
| [dependencies] | |
| thiserror = "1.0.30" | |
| [dependencies.windows] | |
| version = "0.33.0" | |
| features = [ | |
| "Win32_System_Threading", | |
| "Win32_Foundation", | |
| "Win32_Security", | |
| "Win32_System_SystemServices" |