Struct

Struct supports primitive types (integer, bool, address, vector and signer) and other structs (structs provided by Aptos framework like table and user defined structs).

All structs are private in the module. Other modules need to access those via public getter and setter functions.

Abilities

  1. Struct has abilities, which allows developers to give fine-grained control over the "linear" typing behavior of the value (i.e. instance of struct).
  2. There are 4 abilities.
    1. Key allows storing in global address space — resource
    2. Store allows storing under another struct in global address space
    3. Drop allows the data to be implicitly deleted / dropped, otherwise must explicitly deconstruct
    4. Copy allows for data to be implicitly copied, useful for things like strings