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:
parent
5704f2061a
commit
9591f93568
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user