Skip to content

rust book refers to 'str' primitive type as if it has already been introduced #30162

Closed
@ntuckerxx

Description

@ntuckerxx

I'm going through the rust book and have gotten to the Dining Philosophers section, at which point I've encountered the following text:

We choose the String type for the name, rather than &str.

None of the previous introduction has even mentioned a str type, so I had to go looking to find out what it is and how it differs from String. The example seems to assume that the reader would find str the obvious choice, but the reader hasn't heard of str at this point.

I'm brand new to rust myself so I'm not sure how this could be introduced better, but I think simply using String and not mentioning str would be less confusing at this point.

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