From e38fde71b1dede9772043b71fe09c43b4ba61b8c Mon Sep 17 00:00:00 2001 From: klutzy Date: Thu, 29 May 2014 15:17:00 +0900 Subject: [PATCH] doc: Remove use of `pub use` globs --- src/doc/rust.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/rust.md b/src/doc/rust.md index cde26bd8813..61fd83c10d4 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -904,7 +904,7 @@ An example of re-exporting: ~~~~ # fn main() { } mod quux { - pub use quux::foo::*; + pub use quux::foo::{bar, baz}; pub mod foo { pub fn bar() { } @@ -913,10 +913,10 @@ mod quux { } ~~~~ -In this example, the module `quux` re-exports all of the public names defined in `foo`. +In this example, the module `quux` re-exports two public names defined in `foo`. Also note that the paths contained in `use` items are relative to the crate root. -So, in the previous example, the `use` refers to `quux::foo::*`, and not simply to `foo::*`. +So, in the previous example, the `use` refers to `quux::foo::{bar, baz}`, and not simply to `foo::{bar, baz}`. This also means that top-level module declarations should be at the crate root if direct usage of the declared modules within `use` items is desired. It is also possible to use `self` and `super` at the beginning of a `use` item to refer to the current and direct parent modules respectively.