Skip to content

Commit

Permalink
Corrections and additions to the imports modules chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
skade committed May 16, 2017
1 parent bd77cf8 commit b68bf18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions chapters/en-US/imports-modules-and-visibility.chapter
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Public types and functions that can be reached through a public module path are

---

Traits must be public and imported before use.

The compiler will detect if you use an un-imported trait.

---

## Structs

Structs are a little more complex. They don't export fields, which makes their usage and the construction impossible. This is often intended.
Expand All @@ -137,5 +143,6 @@ Also, struct functions are not exported by default.

In general, exporting fields should be avoided:

\* Any change of the structure leads to API breakage
\* Acceessor functions are usually as fast as direct field access due to optimizations.
* Any change of the structure leads to API breakage

* Accessor functions are usually as fast as direct field access due to optimizations.

0 comments on commit b68bf18

Please sign in to comment.