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

     1  package enr
     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 *ID) DecodeMsg(dc *msgp.Reader) (err error) {
    11  	{
    12  		var zb0001 string
    13  		zb0001, err = dc.ReadString()
    14  		if err != nil {
    15  			return
    16  		}
    17  		(*z) = ID(zb0001)
    18  	}
    19  	return
    20  }
    21  
    22  // EncodeMsg implements msgp.Encodable
    23  func (z ID) EncodeMsg(en *msgp.Writer) (err error) {
    24  	err = en.WriteString(string(z))
    25  	if err != nil {
    26  		return
    27  	}
    28  	return
    29  }
    30  
    31  // MarshalMsg implements msgp.Marshaler
    32  func (z ID) MarshalMsg(b []byte) (o []byte, err error) {
    33  	o = msgp.Require(b, z.Msgsize())
    34  	o = msgp.AppendString(o, string(z))
    35  	return
    36  }
    37  
    38  // UnmarshalMsg implements msgp.Unmarshaler
    39  func (z *ID) UnmarshalMsg(bts []byte) (o []byte, err error) {
    40  	{
    41  		var zb0001 string
    42  		zb0001, bts, err = msgp.ReadStringBytes(bts)
    43  		if err != nil {
    44  			return
    45  		}
    46  		(*z) = ID(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 ID) Msgsize() (s int) {
    54  	s = msgp.StringPrefixSize + len(string(z))
    55  	return
    56  }
    57  
    58  // DecodeMsg implements msgp.Decodable
    59  func (z *TCP) DecodeMsg(dc *msgp.Reader) (err error) {
    60  	{
    61  		var zb0001 uint16
    62  		zb0001, err = dc.ReadUint16()
    63  		if err != nil {
    64  			return
    65  		}
    66  		(*z) = TCP(zb0001)
    67  	}
    68  	return
    69  }
    70  
    71  // EncodeMsg implements msgp.Encodable
    72  func (z TCP) EncodeMsg(en *msgp.Writer) (err error) {
    73  	err = en.WriteUint16(uint16(z))
    74  	if err != nil {
    75  		return
    76  	}
    77  	return
    78  }
    79  
    80  // MarshalMsg implements msgp.Marshaler
    81  func (z TCP) MarshalMsg(b []byte) (o []byte, err error) {
    82  	o = msgp.Require(b, z.Msgsize())
    83  	o = msgp.AppendUint16(o, uint16(z))
    84  	return
    85  }
    86  
    87  // UnmarshalMsg implements msgp.Unmarshaler
    88  func (z *TCP) UnmarshalMsg(bts []byte) (o []byte, err error) {
    89  	{
    90  		var zb0001 uint16
    91  		zb0001, bts, err = msgp.ReadUint16Bytes(bts)
    92  		if err != nil {
    93  			return
    94  		}
    95  		(*z) = TCP(zb0001)
    96  	}
    97  	o = bts
    98  	return
    99  }
   100  
   101  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   102  func (z TCP) Msgsize() (s int) {
   103  	s = msgp.Uint16Size
   104  	return
   105  }
   106  
   107  // DecodeMsg implements msgp.Decodable
   108  func (z *UDP) DecodeMsg(dc *msgp.Reader) (err error) {
   109  	{
   110  		var zb0001 uint16
   111  		zb0001, err = dc.ReadUint16()
   112  		if err != nil {
   113  			return
   114  		}
   115  		(*z) = UDP(zb0001)
   116  	}
   117  	return
   118  }
   119  
   120  // EncodeMsg implements msgp.Encodable
   121  func (z UDP) EncodeMsg(en *msgp.Writer) (err error) {
   122  	err = en.WriteUint16(uint16(z))
   123  	if err != nil {
   124  		return
   125  	}
   126  	return
   127  }
   128  
   129  // MarshalMsg implements msgp.Marshaler
   130  func (z UDP) MarshalMsg(b []byte) (o []byte, err error) {
   131  	o = msgp.Require(b, z.Msgsize())
   132  	o = msgp.AppendUint16(o, uint16(z))
   133  	return
   134  }
   135  
   136  // UnmarshalMsg implements msgp.Unmarshaler
   137  func (z *UDP) UnmarshalMsg(bts []byte) (o []byte, err error) {
   138  	{
   139  		var zb0001 uint16
   140  		zb0001, bts, err = msgp.ReadUint16Bytes(bts)
   141  		if err != nil {
   142  			return
   143  		}
   144  		(*z) = UDP(zb0001)
   145  	}
   146  	o = bts
   147  	return
   148  }
   149  
   150  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   151  func (z UDP) Msgsize() (s int) {
   152  	s = msgp.Uint16Size
   153  	return
   154  }