Clarify that non-byte array struct members are omitted by getters

This commit is contained in:
Kamil Śliwak 2021-07-08 13:00:02 +02:00
parent 62934b60ca
commit a1ca12a0a8

View File

@ -188,16 +188,24 @@ The next example is more complex:
uint a; uint a;
bytes3 b; bytes3 b;
mapping (uint => uint) map; mapping (uint => uint) map;
uint[3] c;
uint[] d;
bytes e;
} }
mapping (uint => mapping(bool => Data[])) public data; mapping (uint => mapping(bool => Data[])) public data;
} }
It generates a function of the following form. The mapping in the struct is omitted It generates a function of the following form. The mapping and arrays (with the
because there is no good way to provide the key for the mapping: exception of byte arrays) in the struct are omitted because there is no good way
to select individual struct members or provide a key for the mapping:
.. code-block:: solidity .. code-block:: solidity
function data(uint arg1, bool arg2, uint arg3) public returns (uint a, bytes3 b) { function data(uint arg1, bool arg2, uint arg3)
public
returns (uint a, bytes3 b, bytes memory e)
{
a = data[arg1][arg2][arg3].a; a = data[arg1][arg2][arg3].a;
b = data[arg1][arg2][arg3].b; b = data[arg1][arg2][arg3].b;
e = data[arg1][arg2][arg3].e;
} }