Skip to content

Chapter 5.3 - method syntax - Grammar issue #3359

Closed
rust-lang/rust
#104171
@amitbar05

Description

@amitbar05

In the paragraph:
Often, but not always, when we give methods with the same name as a field we want it to only return the value in the field and do nothing else. Methods like this are called getters, and Rust does not implement them automatically for struct fields as some other languages do. Getters are useful because you can make the field private but the method public and thus enable read-only access to that field as part of the type’s public API. We will be discussing what public and private are and how to designate a field or method as public or private in Chapter 7.

There seems to be a grammar mistake in the first sentence,
"when we give methods with the same name as a field we want it..."
The usage of the word with is wrong (makes it a run-on sentence).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions