Skip to content

Commit 5508733

Browse files
committed
Snapshot changes to ch7 to consider sending to nostarch
1 parent efc4a3d commit 5508733

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

nostarch/chapter07.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ error[E0603]: module `hosting` is private
410410
--> src/lib.rs:9:28
411411
|
412412
9 | crate::front_of_house::hosting::add_to_waitlist();
413-
| ^^^^^^^ private module
413+
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
414+
| |
415+
| private module
414416
|
415417
note: the module `hosting` is defined here
416418
--> src/lib.rs:2:5
@@ -422,7 +424,9 @@ error[E0603]: module `hosting` is private
422424
--> src/lib.rs:12:21
423425
|
424426
12 | front_of_house::hosting::add_to_waitlist();
425-
| ^^^^^^^ private module
427+
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
428+
| |
429+
| private module
426430
|
427431
note: the module `hosting` is defined here
428432
--> src/lib.rs:2:5
@@ -596,8 +600,8 @@ interested in this topic, see The Rust API Guidelines at *https://rust-lang.gith
596600
> root as well as a *src/lib.rs* library crate root, and both crates will have
597601
> the package name by default. Typically, packages with this pattern of
598602
> containing both a library and a binary crate will have just enough code in the
599-
> binary crate to start an executable that calls code with the library crate.
600-
> This lets other projects benefit from the most functionality that the
603+
> binary crate to start an executable that calls code within the library crate.
604+
> This lets other projects benefit from most of the functionality that the
601605
> package provides because the library crate’s code can be shared.
602606
>
603607
> The module tree should be defined in *src/lib.rs*. Then, any public items can
@@ -826,6 +830,11 @@ error[E0433]: failed to resolve: use of undeclared crate or module `hosting`
826830
|
827831
11 | hosting::add_to_waitlist();
828832
| ^^^^^^^ use of undeclared crate or module `hosting`
833+
|
834+
help: consider importing this module through its public re-export
835+
|
836+
10 + use crate::hosting;
837+
|
829838
830839
warning: unused import: `crate::front_of_house::hosting`
831840
--> src/lib.rs:7:5
@@ -992,7 +1001,8 @@ from a new scope with `pub use`
9921001

9931002
Before this change, external code would have to call the `add_to_waitlist`
9941003
function by using the path
995-
`restaurant::front_of_house::hosting::add_to_waitlist()`. Now that this `pub
1004+
`restaurant::front_of_house::hosting::add_to_waitlist()`, which also would have
1005+
required the `front_of_house` module to be marked as `pub`. Now that this `pub
9961006
use` has re-exported the `hosting` module from the root module, external code
9971007
can use the path `restaurant::hosting::add_to_waitlist()` instead.
9981008

0 commit comments

Comments
 (0)