1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-20 17:33:31 +02:00

Add speaker note about fn ptrs (#2680)

This commit is contained in:
Nicole L 2025-02-28 13:20:48 -08:00 committed by GitHub
parent 5704f2061a
commit 9591f93568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,4 +30,15 @@ fn main() {
not capture any variables from their lexical environment. We will see captures
next.
## More to Explore
- The ability to store functions in variables doesn't just apply to closures,
regular functions can be put in variables and then invoked the same way that
closures can: [Example in the playground][fn-ptr].
- The linked example also demonstrates that closures that don't capture
anything can also coerce to a regular function pointer.
</details>
[fn-ptr]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=817cbeeefc49f3d0d180a3d6d54c8bda