Skip to content

Commit

Permalink
Clarify that both crate and super are keywords (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeMathWalker authored Dec 18, 2024
1 parent d5e1c00 commit cc0092b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions book/src/03_ticket_v1/03_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ You can compose the path in various ways:
- starting from the parent module, e.g. `super::my_function`
- starting from the current module, e.g. `sub_module_1::MyStruct`

Both `crate` and `super` are **keywords**.\
`crate` refers to the root of the current crate, while `super` refers to the parent of the current module.

Having to write the full path every time you want to refer to a type can be cumbersome.
To make your life easier, you can introduce a `use` statement to bring the entity into scope.

Expand Down

0 comments on commit cc0092b

Please sign in to comment.