Skip to content

Potential improvement in RefCell<T> and Rc<T> sentences #4425

@petern48

Description

@petern48

In the last paragraph of the Allowing Multiple Owners of Mutable Data with Rc and RefCell section, we have the following.

This technique is pretty neat! By using RefCell<T>, we have an outwardly immutable List value. But we can use the methods on RefCell<T> that provide access to its interior mutability so we can modify our data when we need to.

I find it odd that the book concludes this section by only discussing the role of RefCell and not the Rc part. To me, this would sound more natural as "By using Rc", ... But we can also use the methods on RefCell ... Was the first RefCell meant to say Rc instead? If not, I still feel like this part can be improved.

I'm happy to submit a PR if there's a need.

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