github.com/annchain/OG@v0.0.9/p2p/onode/idscheme_gen.go (about) 1 package onode 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/tinylib/msgp/msgp" 7 ) 8 9 // DecodeMsg implements msgp.Decodable 10 func (z *NullID) DecodeMsg(dc *msgp.Reader) (err error) { 11 var field []byte 12 _ = field 13 var zb0001 uint32 14 zb0001, err = dc.ReadMapHeader() 15 if err != nil { 16 return 17 } 18 for zb0001 > 0 { 19 zb0001-- 20 field, err = dc.ReadMapKeyPtr() 21 if err != nil { 22 return 23 } 24 switch msgp.UnsafeString(field) { 25 default: 26 err = dc.Skip() 27 if err != nil { 28 return 29 } 30 } 31 } 32 return 33 } 34 35 // EncodeMsg implements msgp.Encodable 36 func (z NullID) EncodeMsg(en *msgp.Writer) (err error) { 37 // map header, size 0 38 err = en.Append(0x80) 39 if err != nil { 40 return 41 } 42 return 43 } 44 45 // MarshalMsg implements msgp.Marshaler 46 func (z NullID) MarshalMsg(b []byte) (o []byte, err error) { 47 o = msgp.Require(b, z.Msgsize()) 48 // map header, size 0 49 o = append(o, 0x80) 50 return 51 } 52 53 // UnmarshalMsg implements msgp.Unmarshaler 54 func (z *NullID) UnmarshalMsg(bts []byte) (o []byte, err error) { 55 var field []byte 56 _ = field 57 var zb0001 uint32 58 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 59 if err != nil { 60 return 61 } 62 for zb0001 > 0 { 63 zb0001-- 64 field, bts, err = msgp.ReadMapKeyZC(bts) 65 if err != nil { 66 return 67 } 68 switch msgp.UnsafeString(field) { 69 default: 70 bts, err = msgp.Skip(bts) 71 if err != nil { 72 return 73 } 74 } 75 } 76 o = bts 77 return 78 } 79 80 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 81 func (z NullID) Msgsize() (s int) { 82 s = 1 83 return 84 } 85 86 // DecodeMsg implements msgp.Decodable 87 func (z *S256raw) DecodeMsg(dc *msgp.Reader) (err error) { 88 { 89 var zb0001 []byte 90 zb0001, err = dc.ReadBytes([]byte((*z))) 91 if err != nil { 92 return 93 } 94 (*z) = S256raw(zb0001) 95 } 96 return 97 } 98 99 // EncodeMsg implements msgp.Encodable 100 func (z S256raw) EncodeMsg(en *msgp.Writer) (err error) { 101 err = en.WriteBytes([]byte(z)) 102 if err != nil { 103 return 104 } 105 return 106 } 107 108 // MarshalMsg implements msgp.Marshaler 109 func (z S256raw) MarshalMsg(b []byte) (o []byte, err error) { 110 o = msgp.Require(b, z.Msgsize()) 111 o = msgp.AppendBytes(o, []byte(z)) 112 return 113 } 114 115 // UnmarshalMsg implements msgp.Unmarshaler 116 func (z *S256raw) UnmarshalMsg(bts []byte) (o []byte, err error) { 117 { 118 var zb0001 []byte 119 zb0001, bts, err = msgp.ReadBytesBytes(bts, []byte((*z))) 120 if err != nil { 121 return 122 } 123 (*z) = S256raw(zb0001) 124 } 125 o = bts 126 return 127 } 128 129 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 130 func (z S256raw) Msgsize() (s int) { 131 s = msgp.BytesPrefixSize + len([]byte(z)) 132 return 133 } 134 135 // DecodeMsg implements msgp.Decodable 136 func (z *V4ID) DecodeMsg(dc *msgp.Reader) (err error) { 137 var field []byte 138 _ = field 139 var zb0001 uint32 140 zb0001, err = dc.ReadMapHeader() 141 if err != nil { 142 return 143 } 144 for zb0001 > 0 { 145 zb0001-- 146 field, err = dc.ReadMapKeyPtr() 147 if err != nil { 148 return 149 } 150 switch msgp.UnsafeString(field) { 151 default: 152 err = dc.Skip() 153 if err != nil { 154 return 155 } 156 } 157 } 158 return 159 } 160 161 // EncodeMsg implements msgp.Encodable 162 func (z V4ID) EncodeMsg(en *msgp.Writer) (err error) { 163 // map header, size 0 164 err = en.Append(0x80) 165 if err != nil { 166 return 167 } 168 return 169 } 170 171 // MarshalMsg implements msgp.Marshaler 172 func (z V4ID) MarshalMsg(b []byte) (o []byte, err error) { 173 o = msgp.Require(b, z.Msgsize()) 174 // map header, size 0 175 o = append(o, 0x80) 176 return 177 } 178 179 // UnmarshalMsg implements msgp.Unmarshaler 180 func (z *V4ID) UnmarshalMsg(bts []byte) (o []byte, err error) { 181 var field []byte 182 _ = field 183 var zb0001 uint32 184 zb0001, bts, err = msgp.ReadMapHeaderBytes(bts) 185 if err != nil { 186 return 187 } 188 for zb0001 > 0 { 189 zb0001-- 190 field, bts, err = msgp.ReadMapKeyZC(bts) 191 if err != nil { 192 return 193 } 194 switch msgp.UnsafeString(field) { 195 default: 196 bts, err = msgp.Skip(bts) 197 if err != nil { 198 return 199 } 200 } 201 } 202 o = bts 203 return 204 } 205 206 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 207 func (z V4ID) Msgsize() (s int) { 208 s = 1 209 return 210 }