forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsgp_gen.go
128 lines (119 loc) · 2.97 KB
/
msgp_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package rpcs
// Code generated by github.com/algorand/msgp DO NOT EDIT.
import (
"github.com/algorand/msgp/msgp"
)
// The following msgp objects are implemented in this file:
// EncodedBlockCert
// |-----> (*) MarshalMsg
// |-----> (*) CanMarshalMsg
// |-----> (*) UnmarshalMsg
// |-----> (*) CanUnmarshalMsg
// |-----> (*) Msgsize
// |-----> (*) MsgIsZero
//
// MarshalMsg implements msgp.Marshaler
func (z *EncodedBlockCert) MarshalMsg(b []byte) (o []byte) {
o = msgp.Require(b, z.Msgsize())
// map header, size 2
// string "block"
o = append(o, 0x82, 0xa5, 0x62, 0x6c, 0x6f, 0x63, 0x6b)
o = (*z).Block.MarshalMsg(o)
// string "cert"
o = append(o, 0xa4, 0x63, 0x65, 0x72, 0x74)
o = (*z).Certificate.MarshalMsg(o)
return
}
func (_ *EncodedBlockCert) CanMarshalMsg(z interface{}) bool {
_, ok := (z).(*EncodedBlockCert)
return ok
}
// UnmarshalMsg implements msgp.Unmarshaler
func (z *EncodedBlockCert) UnmarshalMsg(bts []byte) (o []byte, err error) {
var field []byte
_ = field
var zb0001 int
var zb0002 bool
zb0001, zb0002, bts, err = msgp.ReadMapHeaderBytes(bts)
if _, ok := err.(msgp.TypeError); ok {
zb0001, zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
if zb0001 > 0 {
zb0001--
bts, err = (*z).Block.UnmarshalMsg(bts)
if err != nil {
err = msgp.WrapError(err, "struct-from-array", "Block")
return
}
}
if zb0001 > 0 {
zb0001--
bts, err = (*z).Certificate.UnmarshalMsg(bts)
if err != nil {
err = msgp.WrapError(err, "struct-from-array", "Certificate")
return
}
}
if zb0001 > 0 {
err = msgp.ErrTooManyArrayFields(zb0001)
if err != nil {
err = msgp.WrapError(err, "struct-from-array")
return
}
}
} else {
if err != nil {
err = msgp.WrapError(err)
return
}
if zb0002 {
(*z) = EncodedBlockCert{}
}
for zb0001 > 0 {
zb0001--
field, bts, err = msgp.ReadMapKeyZC(bts)
if err != nil {
err = msgp.WrapError(err)
return
}
switch string(field) {
case "block":
bts, err = (*z).Block.UnmarshalMsg(bts)
if err != nil {
err = msgp.WrapError(err, "Block")
return
}
case "cert":
bts, err = (*z).Certificate.UnmarshalMsg(bts)
if err != nil {
err = msgp.WrapError(err, "Certificate")
return
}
default:
err = msgp.ErrNoField(string(field))
if err != nil {
err = msgp.WrapError(err)
return
}
}
}
}
o = bts
return
}
func (_ *EncodedBlockCert) CanUnmarshalMsg(z interface{}) bool {
_, ok := (z).(*EncodedBlockCert)
return ok
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *EncodedBlockCert) Msgsize() (s int) {
s = 1 + 6 + (*z).Block.Msgsize() + 5 + (*z).Certificate.Msgsize()
return
}
// MsgIsZero returns whether this is a zero value
func (z *EncodedBlockCert) MsgIsZero() bool {
return ((*z).Block.MsgIsZero()) && ((*z).Certificate.MsgIsZero())
}