proto, runtime/protoiface: add support for fast-path marshaling
Allow message implementations to provide optimized versions of standard
operations. Generated messages now include a ProtoReflectMethods method,
returning a protoiface.Methods struct containing pointers to assorted
optional functions.
The Methods struct also includes a Flags field indicating support for
optional features such as deterministic marshaling.
Implementation of the fast paths (and tests) will come in later CLs.
Change-Id: Idd1beed0ecf43ec5e5e7b8da2ee1e08d3ce32213
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170340
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/internal/testprotos/test/test_public.pb.go b/internal/testprotos/test/test_public.pb.go
index fde1bd6..1c76763 100644
--- a/internal/testprotos/test/test_public.pb.go
+++ b/internal/testprotos/test/test_public.pb.go
@@ -6,6 +6,7 @@
import (
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry"
+ protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
sync "sync"
)
@@ -32,6 +33,10 @@
return xxx_File_test_test_public_proto_messageTypes[0].MessageOf(x)
}
+func (m *PublicImportMessage) XXX_Methods() *protoiface.Methods {
+ return xxx_File_test_test_public_proto_messageTypes[0].Methods()
+}
+
// Deprecated: Use PublicImportMessage.ProtoReflect.Type instead.
func (*PublicImportMessage) Descriptor() ([]byte, []int) {
return xxx_File_test_test_public_proto_rawDescGZIP(), []int{0}