From 9285d362e9b3dfa41168372279b20d875294a215 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Mon, 28 Mar 2022 21:17:40 -0400 Subject: [PATCH] Clarify pub use example. Fixes #2716. --- ...-04-bringing-paths-into-scope-with-the-use-keyword.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md index 27383f3905..576032ec85 100644 --- a/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md +++ b/src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md @@ -156,10 +156,11 @@ changed to `pub use`. Listing 7-17: Making a name available for any code to use from a new scope with `pub use` -By using `pub use`, external code can now call the `add_to_waitlist` function -using `hosting::add_to_waitlist`. If we hadn’t specified `pub use`, the -`eat_at_restaurant` function could call `hosting::add_to_waitlist` in its -scope, but external code couldn’t take advantage of this new path. +Before this change, external code would have to call the `add_to_waitlist` +function by using the path +`restaurant::front_of_house::hosting::add_to_waitlist()`. Now that this `pub +use` has re-exported the `hosting` module from the root module, external code +can now use the path `restaurant::hosting::add_to_waitlist()` instead. Re-exporting is useful when the internal structure of your code is different from how programmers calling your code would think about the domain. For