package proto
import (
protoV2
)
func ( Message) int {
if == nil {
return 0
}
:= MessageV2()
return protoV2.Size()
}
func ( Message) ([]byte, error) {
, := marshalAppend(nil, , false)
if == nil {
= zeroBytes
}
return ,
}
var zeroBytes = make([]byte, 0, 0)
func ( []byte, Message, bool) ([]byte, error) {
if == nil {
return nil, ErrNil
}
:= MessageV2()
, := protoV2.MarshalOptions{
Deterministic: ,
AllowPartial: true,
}.MarshalAppend(, )
if != nil {
return ,
}
if len() == len() {
if !.ProtoReflect().IsValid() {
return , ErrNil
}
}
return , checkRequiredNotSet()
}
func ( []byte, Message) error {
.Reset()
return UnmarshalMerge(, )
}
func ( []byte, Message) error {
:= MessageV2()
, := protoV2.UnmarshalOptions{
AllowPartial: true,
Merge: true,
}.UnmarshalState(protoiface.UnmarshalInput{
Buf: ,
Message: .ProtoReflect(),
})
if != nil {
return
}
if .Flags&protoiface.UnmarshalInitialized > 0 {
return nil
}
return checkRequiredNotSet()
}