Modules
Modules organize code into named namespaces. Each aspect of the module system has a dedicated chapter:
| Topic | Description |
|---|---|
| Declaration | Declaring and nesting modules |
| Items Visibility | Controlling what is exported with pub |
| Import | Bringing names into the current scope |
See Also
- Packages — how modules are bundled and distributed
- Identifiers — naming rules for modules and items
Implementation
extend attaches methods to a type, optionally satisfying one or more interfaces.
Declaration
Modules organize code into named namespaces. A module is declared with the module keyword and can appear anywhere in a source file. Multiple modules can exist in one file, and modules can be nested.