methods.go raw

   1  // Copyright 2020 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  package protoreflect
   6  
   7  import (
   8  	"google.golang.org/protobuf/internal/pragma"
   9  )
  10  
  11  // The following types are used by the fast-path Message.ProtoMethods method.
  12  //
  13  // To avoid polluting the public protoreflect API with types used only by
  14  // low-level implementations, the canonical definitions of these types are
  15  // in the runtime/protoiface package. The definitions here and in protoiface
  16  // must be kept in sync.
  17  type (
  18  	methods = struct {
  19  		pragma.NoUnkeyedLiterals
  20  		Flags            supportFlags
  21  		Size             func(sizeInput) sizeOutput
  22  		Marshal          func(marshalInput) (marshalOutput, error)
  23  		Unmarshal        func(unmarshalInput) (unmarshalOutput, error)
  24  		Merge            func(mergeInput) mergeOutput
  25  		CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)
  26  		Equal            func(equalInput) equalOutput
  27  	}
  28  	supportFlags = uint64
  29  	sizeInput    = struct {
  30  		pragma.NoUnkeyedLiterals
  31  		Message Message
  32  		Flags   uint8
  33  	}
  34  	sizeOutput = struct {
  35  		pragma.NoUnkeyedLiterals
  36  		Size int
  37  	}
  38  	marshalInput = struct {
  39  		pragma.NoUnkeyedLiterals
  40  		Message Message
  41  		Buf     []byte
  42  		Flags   uint8
  43  	}
  44  	marshalOutput = struct {
  45  		pragma.NoUnkeyedLiterals
  46  		Buf []byte
  47  	}
  48  	unmarshalInput = struct {
  49  		pragma.NoUnkeyedLiterals
  50  		Message  Message
  51  		Buf      []byte
  52  		Flags    uint8
  53  		Resolver interface {
  54  			FindExtensionByName(field FullName) (ExtensionType, error)
  55  			FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)
  56  		}
  57  		Depth int
  58  	}
  59  	unmarshalOutput = struct {
  60  		pragma.NoUnkeyedLiterals
  61  		Flags uint8
  62  	}
  63  	mergeInput = struct {
  64  		pragma.NoUnkeyedLiterals
  65  		Source      Message
  66  		Destination Message
  67  	}
  68  	mergeOutput = struct {
  69  		pragma.NoUnkeyedLiterals
  70  		Flags uint8
  71  	}
  72  	checkInitializedInput = struct {
  73  		pragma.NoUnkeyedLiterals
  74  		Message Message
  75  	}
  76  	checkInitializedOutput = struct {
  77  		pragma.NoUnkeyedLiterals
  78  	}
  79  	equalInput = struct {
  80  		pragma.NoUnkeyedLiterals
  81  		MessageA Message
  82  		MessageB Message
  83  	}
  84  	equalOutput = struct {
  85  		pragma.NoUnkeyedLiterals
  86  		Equal bool
  87  	}
  88  )
  89