github.com/annchain/OG@v0.0.9/p2p/peer_error_gen.go (about)

     1  package p2p
     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 *DiscReason) DecodeMsg(dc *msgp.Reader) (err error) {
    11  	{
    12  		var zb0001 uint16
    13  		zb0001, err = dc.ReadUint16()
    14  		if err != nil {
    15  			return
    16  		}
    17  		(*z) = DiscReason(zb0001)
    18  	}
    19  	return
    20  }
    21  
    22  // EncodeMsg implements msgp.Encodable
    23  func (z DiscReason) EncodeMsg(en *msgp.Writer) (err error) {
    24  	err = en.WriteUint16(uint16(z))
    25  	if err != nil {
    26  		return
    27  	}
    28  	return
    29  }
    30  
    31  // MarshalMsg implements msgp.Marshaler
    32  func (z DiscReason) MarshalMsg(b []byte) (o []byte, err error) {
    33  	o = msgp.Require(b, z.Msgsize())
    34  	o = msgp.AppendUint16(o, uint16(z))
    35  	return
    36  }
    37  
    38  // UnmarshalMsg implements msgp.Unmarshaler
    39  func (z *DiscReason) UnmarshalMsg(bts []byte) (o []byte, err error) {
    40  	{
    41  		var zb0001 uint16
    42  		zb0001, bts, err = msgp.ReadUint16Bytes(bts)
    43  		if err != nil {
    44  			return
    45  		}
    46  		(*z) = DiscReason(zb0001)
    47  	}
    48  	o = bts
    49  	return
    50  }
    51  
    52  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    53  func (z DiscReason) Msgsize() (s int) {
    54  	s = msgp.Uint16Size
    55  	return
    56  }