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

Function Reset

proto/reset.go:16–22  ·  view source on GitHub ↗

Reset clears every field in the message. The resulting message shares no observable memory with its previous state other than the memory for the message itself.

(m Message)

Source from the content-addressed store, hash-verified

14// The resulting message shares no observable memory with its previous state
15// other than the memory for the message itself.
16func Reset(m Message) {
17 if mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods {
18 mr.Reset()
19 return
20 }
21 resetMessage(m.ProtoReflect())
22}
23
24func resetMessage(m protoreflect.Message) {
25 if !m.IsValid() {

Callers 7

unmarshalMethod · 0.92
unmarshalMethod · 0.92
TestNilFunction · 0.92
TestResetFunction · 0.92
testMethodsFunction · 0.92
ResetMethod · 0.92
unmarshalMethod · 0.85

Calls 3

resetMessageFunction · 0.85
ResetMethod · 0.65
ProtoReflectMethod · 0.65

Tested by 3

TestNilFunction · 0.74
TestResetFunction · 0.74
testMethodsFunction · 0.74