Skip to content

Commit

Permalink
Mention pub for structs and fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lastorset committed Jul 25, 2015
1 parent e333e6a commit 95c7f30
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/doc/trpl/crates-and-modules.md
Expand Up @@ -355,6 +355,10 @@ Hello in English: Hello!
Goodbye in English: Goodbye.
```
`pub` also applies to `struct`s and their member fields. In keeping with Rust’s
tendency toward safety, simply making a `struct` public won't automatically
make its members public: you must mark the fields individually with `pub`.
Now that our functions are public, we can use them. Great! However, typing out
`phrases::english::greetings::hello()` is very long and repetitive. Rust has
another keyword for importing names into the current scope, so that you can
Expand Down

0 comments on commit 95c7f30

Please sign in to comment.