MCPcopy
hub / github.com/protocolbuffers/protobuf-go / Mutable

Method Mutable

internal/reflection_test/reflection_test.go:601–611  ·  view source on GitHub ↗
(k protoreflect.MapKey)

Source from the content-addressed store, hash-verified

599 }
600}
601func (x *testMap) Mutable(k protoreflect.MapKey) protoreflect.Value {
602 if x.fd.MapValue().Message() == nil {
603 panic("invalid Mutable on map with non-message value type")
604 }
605 v := x.Get(k)
606 if !v.IsValid() {
607 v = x.NewValue()
608 x.Set(k, v)
609 }
610 return v
611}
612func (x *testMap) Clear(k protoreflect.MapKey) { x.val.SetMapIndex(x.key(k), reflect.Value{}) }
613func (x *testMap) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
614 iter := x.val.MapRange()

Callers

nothing calls this directly

Calls 6

GetMethod · 0.95
NewValueMethod · 0.95
SetMethod · 0.95
MessageMethod · 0.65
MapValueMethod · 0.65
IsValidMethod · 0.65

Tested by

no test coverage detected