MCPcopy
hub / github.com/gogo/protobuf / Unmarshal

Function Unmarshal

proto/decode.go:334–343  ·  view source on GitHub ↗

Unmarshal parses the protocol buffer representation in buf and places the decoded result in pb. If the struct underlying pb does not match the data in buf, the results can be unpredictable. Unmarshal resets pb before starting to unmarshal, so any existing data in pb is always removed. Use Unmarsha

(buf []byte, pb Message)

Source from the content-addressed store, hash-verified

332// existing data in pb is always removed. Use UnmarshalMerge
333// to preserve and append to existing data.
334func Unmarshal(buf []byte, pb Message) error {
335 pb.Reset()
336 if u, ok := pb.(newUnmarshaler); ok {
337 return u.XXX_Unmarshal(buf)
338 }
339 if u, ok := pb.(Unmarshaler); ok {
340 return u.Unmarshal(buf)
341 }
342 return NewBuffer(buf).Unmarshal(pb)
343}
344
345// UnmarshalMerge parses the protocol buffer representation in buf and
346// writes the decoded result to pb. If the struct underlying pb does not match

Calls 4

NewBufferFunction · 0.85
ResetMethod · 0.65
XXX_UnmarshalMethod · 0.65
UnmarshalMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…