Skip to content

Commit c3fa520

Browse files
authored
Merge pull request #11636 from ethereum/docs-clarify-struct-members-omitted-by-getters
[Docs] Clarify that non-byte array struct members are omitted by getters
2 parents fec01c1 + a1ca12a commit c3fa520

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/contracts/visibility-and-getters.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,24 @@ The next example is more complex:
188188
uint a;
189189
bytes3 b;
190190
mapping (uint => uint) map;
191+
uint[3] c;
192+
uint[] d;
193+
bytes e;
191194
}
192195
mapping (uint => mapping(bool => Data[])) public data;
193196
}
194197
195-
It generates a function of the following form. The mapping in the struct is omitted
196-
because there is no good way to provide the key for the mapping:
198+
It generates a function of the following form. The mapping and arrays (with the
199+
exception of byte arrays) in the struct are omitted because there is no good way
200+
to select individual struct members or provide a key for the mapping:
197201

198202
.. code-block:: solidity
199203
200-
function data(uint arg1, bool arg2, uint arg3) public returns (uint a, bytes3 b) {
204+
function data(uint arg1, bool arg2, uint arg3)
205+
public
206+
returns (uint a, bytes3 b, bytes memory e)
207+
{
201208
a = data[arg1][arg2][arg3].a;
202209
b = data[arg1][arg2][arg3].b;
210+
e = data[arg1][arg2][arg3].e;
203211
}

0 commit comments

Comments
 (0)