go/src/reflect
Josh Bleecher Snyder 54cdef1f10 reflect: add MapIter.SetKey and MapIter.SetValue
These augment the existing MapIter.Key and MapIter.Value methods.
The existing methods return new Values.
Constructing these new Values often requires allocating.
These methods allow the caller to bring their own storage.

The naming is somewhat unfortunate, in that the spec
uses the word "element" instead of "value",
as do the reflect.Type methods.
In a vacuum, MapIter.SetElem would be preferable.
However, matching the existing methods is more important.

Fixes #32424
Fixes #46131

Change-Id: I19c4d95c432f63dfe52cde96d2125abd021f24fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/320929
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2021-08-24 22:23:12 +00:00
..
internal reflect: fix stack overflow panic when using haveIdenticalUnderlyingType 2021-04-20 20:14:14 +00:00
abi.go [dev.typeparams] reflect: use goarch.PtrSize instead of the duplicated ptrSize [generated] 2021-06-17 21:29:22 +00:00
abi_test.go [dev.typeparams] all: merge master (fdab5be) into dev.typeparams 2021-06-14 13:24:47 -07:00
all_test.go reflect: add MapIter.SetKey and MapIter.SetValue 2021-08-24 22:23:12 +00:00
asm_386.s reflect: add register ABI support for makeFuncStub and methodValueCall 2021-04-02 16:53:18 +00:00
asm_amd64.s [dev.typeparams] reflect: call ABI0 spill/unspill functions on AMD64 2021-06-01 22:33:29 +00:00
asm_arm.s reflect: add register ABI support for makeFuncStub and methodValueCall 2021-04-02 16:53:18 +00:00
asm_arm64.s [dev.typeparams] reflect: implement register ABI for MakeFunc etc. on ARM64 2021-06-02 16:50:22 +00:00
asm_mips64x.s all: add //go:build lines to assembly files 2021-05-13 09:12:17 +00:00
asm_mipsx.s all: add //go:build lines to assembly files 2021-05-13 09:12:17 +00:00
asm_ppc64x.s all: add //go:build lines to assembly files 2021-05-13 09:12:17 +00:00
asm_riscv64.s reflect: add register ABI support for makeFuncStub and methodValueCall 2021-04-02 16:53:18 +00:00
asm_s390x.s reflect: add register ABI support for makeFuncStub and methodValueCall 2021-04-02 16:53:18 +00:00
asm_wasm.s reflect: add register ABI support for makeFuncStub and methodValueCall 2021-04-02 16:53:18 +00:00
deepequal.go
example_test.go reflect: add example for FieldByIndex 2021-08-22 13:14:19 +00:00
export_test.go [dev.typeparams] reflect: delete unused ptrSize and PtrSize 2021-06-17 21:29:28 +00:00
makefunc.go [dev.typeparams] reflect: use internal/abi.FuncPCABI0 to take address of assembly functions 2021-05-24 21:05:34 +00:00
set_test.go
swapper.go [dev.typeparams] reflect: use goarch.PtrSize instead of the duplicated ptrSize [generated] 2021-06-17 21:29:22 +00:00
tostring_test.go
type.go [dev.typeparams] all: merge master (296ddf2) into dev.typeparams 2021-07-08 13:11:32 -07:00
value.go reflect: add MapIter.SetKey and MapIter.SetValue 2021-08-24 22:23:12 +00:00
visiblefields.go reflect: add missing copyright header 2021-07-21 20:29:18 +00:00
visiblefields_test.go reflect: add missing copyright header 2021-07-21 20:29:18 +00:00