Skip to content

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

@iven

Description

@iven

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions