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

Method Size

proto/size.go:28–35  ·  view source on GitHub ↗

Size returns the size in bytes of the wire-format encoding of m. Note that Size might return more bytes than Marshal will write in the case of lazily decoded messages that arrive in non-minimal wire format: see https://protobuf.dev/reference/go/size/ for more details.

(m Message)

Source from the content-addressed store, hash-verified

26// lazily decoded messages that arrive in non-minimal wire format: see
27// https://protobuf.dev/reference/go/size/ for more details.
28func (o MarshalOptions) Size(m Message) int {
29 // Treat a nil message interface as an empty message; nothing to output.
30 if m == nil {
31 return 0
32 }
33
34 return o.size(m.ProtoReflect())
35}
36
37// size is a centralized function that all size operations go through.
38// For profiling purposes, avoid changing the name of this function or

Callers 4

SizeFunction · 0.45
sizeMethod · 0.45
marshalMethod · 0.45

Calls 2

sizeMethod · 0.95
ProtoReflectMethod · 0.65

Tested by

no test coverage detected