Skip to content

Commit

Permalink
Merge pull request #1097 from lf94/patch-1
Browse files Browse the repository at this point in the history
Add how to use brace bracket syntax
  • Loading branch information
marioidival authored Sep 6, 2018
2 parents 1f95397 + 6feca85 commit e459fb3
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/mod/use.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# The `use` declaration

The `use` declaration can be used to bind a full path to a new name, for easier
access.
access. It is often used like this:

```rust,editable
```rust,editable,ignore
// extern crate deeply; // normally, this would exist and not be commented out!
use deeply::nested::{
my_first_function,
my_second_function,
AndATraitType
};
fn main() {
my_first_function();
}
```

You can use the `as` keyword to bind imports to a different name:

```rust,editable,ignore
// Bind the `deeply::nested::function` path to `other_function`.
use deeply::nested::function as other_function;
Expand Down Expand Up @@ -37,4 +53,4 @@ fn main() {
function();
}
```
```

0 comments on commit e459fb3

Please sign in to comment.