Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ownership P2: Add Closures Example #69

Open
wants to merge 2 commits into
base: ownership-part2-v3
Choose a base branch
from

Conversation

jespiron
Copy link
Member

@jespiron jespiron commented Feb 22, 2025

This PR adds the following example to Lecture 8.
Note: I'm also open to adding this to Lecture 7 instead, and deleting the Crates section from Lecture 7

Clarifies some concepts from Lecture 7: Closures and Iterators using Ownership P2's new ownership model:

  • Why moving a value out of a closure makes it FnOnce
  • Why a captured value in a closure is dropped when the closure goes out of scope, not when we call and return from the closure

Also solidifies what the move keyword does, which prepares them for the Parallelism and Concurrency lectures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant