Skip to content

Rust Book chapter 3.2: explain why table.clone() is needed #25597

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

Closed
iven opened this issue May 19, 2015 · 1 comment
Closed

Rust Book chapter 3.2: explain why table.clone() is needed #25597

iven opened this issue May 19, 2015 · 1 comment

Comments

@iven
Copy link
Contributor

iven commented May 19, 2015

In the book:

Finally, inside of our map()/collect() loop, we call table.clone(). The clone() method on Arc is what bumps up the reference count, and when it goes out of scope, it decrements the count.

I think it's better to add a few lines and let the readers know why bumping up the reference count here is needed.

@steveklabnik
Copy link
Member

It's hard to figure out what level of depth to go into in these higher-level docs, you're right.

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

No branches or pull requests

2 participants