Skip to content

Add how to use brace bracket syntax #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 6, 2018
Merged
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
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();
}
```
```