Clarify that both crate and super are keywords (#236)

This commit is contained in:
Luca Palmieri 2024-12-18 17:13:27 +01:00 committed by GitHub
parent d5e1c00108
commit cc0092b2c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 parent module, e.g. `super::my_function`
- starting from the current module, e.g. `sub_module_1::MyStruct` - 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. 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. To make your life easier, you can introduce a `use` statement to bring the entity into scope.