github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/accounts/manager_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package accounts
     4  
     5  import (
     6  	json "encoding/json"
     7  
     8  	easyjson "github.com/mailru/easyjson"
     9  	jlexer "github.com/mailru/easyjson/jlexer"
    10  	jwriter "github.com/mailru/easyjson/jwriter"
    11  )
    12  
    13  // suppress unused package warning
    14  var (
    15  	_ *json.RawMessage
    16  	_ *jlexer.Lexer
    17  	_ *jwriter.Writer
    18  	_ easyjson.Marshaler
    19  )
    20  
    21  func easyjsonEd74d837DecodeGithubComEthereumprojectGoEthereumAccounts(in *jlexer.Lexer, out *AccountJSON) {
    22  	isTopLevel := in.IsStart()
    23  	if in.IsNull() {
    24  		if isTopLevel {
    25  			in.Consumed()
    26  		}
    27  		in.Skip()
    28  		return
    29  	}
    30  	in.Delim('{')
    31  	for !in.IsDelim('}') {
    32  		key := in.UnsafeString()
    33  		in.WantColon()
    34  		if in.IsNull() {
    35  			in.Skip()
    36  			in.WantComma()
    37  			continue
    38  		}
    39  		switch key {
    40  		case "address":
    41  			out.Address = string(in.String())
    42  		case "key":
    43  			out.EncryptedKey = string(in.String())
    44  		case "file":
    45  			out.File = string(in.String())
    46  		default:
    47  			in.SkipRecursive()
    48  		}
    49  		in.WantComma()
    50  	}
    51  	in.Delim('}')
    52  	if isTopLevel {
    53  		in.Consumed()
    54  	}
    55  }
    56  func easyjsonEd74d837EncodeGithubComEthereumprojectGoEthereumAccounts(out *jwriter.Writer, in AccountJSON) {
    57  	out.RawByte('{')
    58  	first := true
    59  	_ = first
    60  	if !first {
    61  		out.RawByte(',')
    62  	}
    63  	first = false
    64  	out.RawString("\"address\":")
    65  	out.String(string(in.Address))
    66  	if !first {
    67  		out.RawByte(',')
    68  	}
    69  	first = false
    70  	out.RawString("\"key\":")
    71  	out.String(string(in.EncryptedKey))
    72  	if !first {
    73  		out.RawByte(',')
    74  	}
    75  	first = false
    76  	out.RawString("\"file\":")
    77  	out.String(string(in.File))
    78  	out.RawByte('}')
    79  }
    80  
    81  // MarshalJSON supports json.Marshaler interface
    82  func (v AccountJSON) MarshalJSON() ([]byte, error) {
    83  	w := jwriter.Writer{}
    84  	easyjsonEd74d837EncodeGithubComEthereumprojectGoEthereumAccounts(&w, v)
    85  	return w.Buffer.BuildBytes(), w.Error
    86  }
    87  
    88  // MarshalEasyJSON supports easyjson.Marshaler interface
    89  func (v AccountJSON) MarshalEasyJSON(w *jwriter.Writer) {
    90  	easyjsonEd74d837EncodeGithubComEthereumprojectGoEthereumAccounts(w, v)
    91  }
    92  
    93  // UnmarshalJSON supports json.Unmarshaler interface
    94  func (v *AccountJSON) UnmarshalJSON(data []byte) error {
    95  	r := jlexer.Lexer{Data: data}
    96  	easyjsonEd74d837DecodeGithubComEthereumprojectGoEthereumAccounts(&r, v)
    97  	return r.Error()
    98  }
    99  
   100  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   101  func (v *AccountJSON) UnmarshalEasyJSON(l *jlexer.Lexer) {
   102  	easyjsonEd74d837DecodeGithubComEthereumprojectGoEthereumAccounts(l, v)
   103  }