Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/mod/use.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,24 @@ fn main() {
function();
}
```

You can also use `pub use` to re-export an item from a module, so it can be
accessed through the module's public interface:

```rust,editable
mod deeply {
pub mod nested {
pub fn function() {
println!("called `deeply::nested::function()`");
}
}
}

mod cool {
pub use crate::deeply::nested::function;
}

fn main() {
cool::function();
}
```
Loading