Module storage
Functions
- This function
- marks the contract as having storage, so that
macros::utils::module_has_storagewill return true, - marks the struct
sas the one describing the storage layout of a contract, - generates an
implblock for the storage struct with aninitfunction (call toinitis then injected at the beginning of every#[external(...)]and#[internal]contract function and the storage is then available asself.storage), - creates a
StorageLayoutstruct that is is exposed via theabi(storage)macro in the contract artifact.
- marks the contract as having storage, so that
- Same as
storage, except the user is in charge of providing an implementation of theinitconstructor function with signaturefn init<Context>(context: Context) -> Self, which allows for manual control of storage slot allocation. Similarly, noStorageLayoutstruct will be created.
Globals
- Stores a map from a module to the name of the struct that describes its storage layout. This is then used when generating a
storage_layout()getter on the contract struct.