github.com/klaytn/klaytn@v1.12.1/rlp/rlpgen/testdata/rawvalue.out.txt (about)

     1  package test
     2  
     3  import "github.com/klaytn/klaytn/rlp"
     4  import "io"
     5  
     6  func (obj *Test) EncodeRLP(_w io.Writer) error {
     7  	w := rlp.NewEncoderBuffer(_w)
     8  	_tmp0 := w.List()
     9  	w.Write(obj.RawValue)
    10  	if obj.PointerToRawValue == nil {
    11  		w.Write([]byte{0x80})
    12  	} else {
    13  		w.Write((*obj.PointerToRawValue))
    14  	}
    15  	_tmp1 := w.List()
    16  	for _, _tmp2 := range obj.SliceOfRawValue {
    17  		w.Write(_tmp2)
    18  	}
    19  	w.ListEnd(_tmp1)
    20  	w.ListEnd(_tmp0)
    21  	return w.Flush()
    22  }
    23  
    24  func (obj *Test) DecodeRLP(dec *rlp.Stream) error {
    25  	var _tmp0 Test
    26  	{
    27  		if _, err := dec.List(); err != nil {
    28  			return err
    29  		}
    30  		// RawValue:
    31  		_tmp1, err := dec.Raw()
    32  		if err != nil {
    33  			return err
    34  		}
    35  		_tmp0.RawValue = _tmp1
    36  		// PointerToRawValue:
    37  		_tmp2, err := dec.Raw()
    38  		if err != nil {
    39  			return err
    40  		}
    41  		_tmp0.PointerToRawValue = &_tmp2
    42  		// SliceOfRawValue:
    43  		var _tmp3 []rlp.RawValue
    44  		if _, err := dec.List(); err != nil {
    45  			return err
    46  		}
    47  		for dec.MoreDataInList() {
    48  			_tmp4, err := dec.Raw()
    49  			if err != nil {
    50  				return err
    51  			}
    52  			_tmp3 = append(_tmp3, _tmp4)
    53  		}
    54  		if err := dec.ListEnd(); err != nil {
    55  			return err
    56  		}
    57  		_tmp0.SliceOfRawValue = _tmp3
    58  		if err := dec.ListEnd(); err != nil {
    59  			return err
    60  		}
    61  	}
    62  	*obj = _tmp0
    63  	return nil
    64  }