proto

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 17

Documentation

Overview

Package proto provides Protocol Buffer marshaling, unmarshaling, equality, and cloning helpers. Its marshaling and unmarshaling helpers support both v1 and v2 message interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneOf added in v0.22.0

func CloneOf[M Message](m M) M

CloneOf returns a deep copy of m, preserving m's concrete message type.

func Equal

func Equal(x, y Message) bool

Equal reports whether two messages are equal, by recursively comparing the fields of the message.

func Marshal

func Marshal(m Message) ([]byte, error)

Marshal returns the wire-format encoding of m.

func MarshalV1 added in v0.7.0

func MarshalV1(m MessageV1) ([]byte, error)

MarshalV1 returns the wire-format encoding of m. The provided message is a v1 message.

func Size added in v0.26.0

func Size(m Message) int

Size returns the size in bytes of the wire-format encoding of m.

func Unmarshal

func Unmarshal(b []byte, m Message) error

Unmarshal parses the wire-format message in b and places the result in m. The provided message must be mutable (e.g., a non-nil pointer to a message).

func UnmarshalV1 added in v0.7.0

func UnmarshalV1(b []byte, m MessageV1) error

UnmarshalV1 parses the wire-format message in b and places the result in m. The provided message is a v1 message.

Types

type Message

type Message = proto.Message

func Clone

func Clone(src Message) Message

Clone returns a deep copy of m. If the top-level message is invalid, it returns an invalid message as well.

type MessageV1 added in v0.7.0

type MessageV1 = protoadapt.MessageV1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL