Module Structure
Module Naming
Modules follow the formataddress::module_name:
Imports
Using Other Modules
Public Use (Re-exports)
Visibility
- Private (Default)
- Public
- Public(package)
- Entry
Init Function
Theinit function runs once when a module is published:
The
init function receives a one-time witness (a struct with the same name as the module) that can be used for privileged operations like creating currencies.Friend Modules
Package Organization
Packages contain multiple modules:Move.toml
Best Practices
Organize by functionality
Organize by functionality
Use minimal visibility
Use minimal visibility
Document modules
Document modules
Related Topics
Move Overview
Learn Move basics
Move Functions
Understand functions
Move Abilities
Type abilities explained