@@ -112,19 +112,10 @@ func (z Keys) MarshalMsg(b []byte) (o []byte, err error) {
112112 if z [xvk ] == nil {
113113 o = msgp .AppendNil (o )
114114 } else {
115- // map header, size 3
116- // string "u"
117- o = append (o , 0x83 , 0xa1 , 0x75 )
118- o = msgp .AppendBytes (o , []byte (z [xvk ].UUID ))
119- // string "v"
120- o = append (o , 0xa1 , 0x76 )
121- o , err = msgp .AppendIntf (o , z [xvk ].Value )
115+ o , err = z [xvk ].MarshalMsg (o )
122116 if err != nil {
123117 return
124118 }
125- // string "p"
126- o = append (o , 0xa1 , 0x70 )
127- o = msgp .AppendBytes (o , z [xvk ].Payload )
128119 }
129120 }
130121 return
@@ -153,46 +144,10 @@ func (z *Keys) UnmarshalMsg(bts []byte) (o []byte, err error) {
153144 if (* z )[bzg ] == nil {
154145 (* z )[bzg ] = new (Key )
155146 }
156- var field []byte
157- _ = field
158- var isz uint32
159- isz , bts , err = msgp .ReadMapHeaderBytes (bts )
147+ bts , err = (* z )[bzg ].UnmarshalMsg (bts )
160148 if err != nil {
161149 return
162150 }
163- for isz > 0 {
164- isz --
165- field , bts , err = msgp .ReadMapKeyZC (bts )
166- if err != nil {
167- return
168- }
169- switch msgp .UnsafeString (field ) {
170- case "u" :
171- {
172- var tmp []byte
173- tmp , bts , err = msgp .ReadBytesBytes (bts , []byte ((* z )[bzg ].UUID ))
174- (* z )[bzg ].UUID = ID (tmp )
175- }
176- if err != nil {
177- return
178- }
179- case "v" :
180- (* z )[bzg ].Value , bts , err = msgp .ReadIntfBytes (bts )
181- if err != nil {
182- return
183- }
184- case "p" :
185- (* z )[bzg ].Payload , bts , err = msgp .ReadBytesBytes (bts , (* z )[bzg ].Payload )
186- if err != nil {
187- return
188- }
189- default :
190- bts , err = msgp .Skip (bts )
191- if err != nil {
192- return
193- }
194- }
195- }
196151 }
197152 }
198153 o = bts
@@ -205,7 +160,7 @@ func (z Keys) Msgsize() (s int) {
205160 if z [bai ] == nil {
206161 s += msgp .NilSize
207162 } else {
208- s += 1 + 2 + msgp . BytesPrefixSize + len ([] byte ( z [bai ].UUID )) + 2 + msgp . GuessSize ( z [ bai ]. Value ) + 2 + msgp . BytesPrefixSize + len ( z [ bai ]. Payload )
163+ s += z [bai ].Msgsize ( )
209164 }
210165 }
211166 return
@@ -237,19 +192,10 @@ func (z *Node) MarshalMsg(b []byte) (o []byte, err error) {
237192 if z .ChildKeys [ajw ] == nil {
238193 o = msgp .AppendNil (o )
239194 } else {
240- // map header, size 3
241- // string "u"
242- o = append (o , 0x83 , 0xa1 , 0x75 )
243- o = msgp .AppendBytes (o , []byte (z .ChildKeys [ajw ].UUID ))
244- // string "v"
245- o = append (o , 0xa1 , 0x76 )
246- o , err = msgp .AppendIntf (o , z .ChildKeys [ajw ].Value )
195+ o , err = z .ChildKeys [ajw ].MarshalMsg (o )
247196 if err != nil {
248197 return
249198 }
250- // string "p"
251- o = append (o , 0xa1 , 0x70 )
252- o = msgp .AppendBytes (o , z .ChildKeys [ajw ].Payload )
253199 }
254200 }
255201 return
@@ -324,44 +270,10 @@ func (z *Node) UnmarshalMsg(bts []byte) (o []byte, err error) {
324270 if z .ChildKeys [ajw ] == nil {
325271 z .ChildKeys [ajw ] = new (Key )
326272 }
327- var isz uint32
328- isz , bts , err = msgp .ReadMapHeaderBytes (bts )
273+ bts , err = z .ChildKeys [ajw ].UnmarshalMsg (bts )
329274 if err != nil {
330275 return
331276 }
332- for isz > 0 {
333- isz --
334- field , bts , err = msgp .ReadMapKeyZC (bts )
335- if err != nil {
336- return
337- }
338- switch msgp .UnsafeString (field ) {
339- case "u" :
340- {
341- var tmp []byte
342- tmp , bts , err = msgp .ReadBytesBytes (bts , []byte (z .ChildKeys [ajw ].UUID ))
343- z .ChildKeys [ajw ].UUID = ID (tmp )
344- }
345- if err != nil {
346- return
347- }
348- case "v" :
349- z .ChildKeys [ajw ].Value , bts , err = msgp .ReadIntfBytes (bts )
350- if err != nil {
351- return
352- }
353- case "p" :
354- z .ChildKeys [ajw ].Payload , bts , err = msgp .ReadBytesBytes (bts , z .ChildKeys [ajw ].Payload )
355- if err != nil {
356- return
357- }
358- default :
359- bts , err = msgp .Skip (bts )
360- if err != nil {
361- return
362- }
363- }
364- }
365277 }
366278 }
367279 default :
@@ -385,7 +297,7 @@ func (z *Node) Msgsize() (s int) {
385297 if z .ChildKeys [ajw ] == nil {
386298 s += msgp .NilSize
387299 } else {
388- s += 1 + 2 + msgp . BytesPrefixSize + len ([] byte ( z .ChildKeys [ajw ].UUID )) + 2 + msgp . GuessSize ( z . ChildKeys [ ajw ]. Value ) + 2 + msgp . BytesPrefixSize + len ( z . ChildKeys [ ajw ]. Payload )
300+ s += z .ChildKeys [ajw ].Msgsize ( )
389301 }
390302 }
391303 return
0 commit comments