mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-27 15:26:51 +00:00
proto: add reference to size semantics with lazy decoding to comment
For golang/protobuf#1657 Change-Id: I01007ed586d1833517735cf5f38cca302efb9801 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/635137 Reviewed-by: Cassondra Foesch <cfoesch@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
560503ec5d
commit
5376513e4b
@ -12,11 +12,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Size returns the size in bytes of the wire-format encoding of m.
|
// 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.
|
||||||
func Size(m Message) int {
|
func Size(m Message) int {
|
||||||
return MarshalOptions{}.Size(m)
|
return MarshalOptions{}.Size(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the size in bytes of the wire-format encoding of m.
|
// 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.
|
||||||
func (o MarshalOptions) Size(m Message) int {
|
func (o MarshalOptions) Size(m Message) int {
|
||||||
// Treat a nil message interface as an empty message; nothing to output.
|
// Treat a nil message interface as an empty message; nothing to output.
|
||||||
if m == nil {
|
if m == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user