github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_put_fleets_fleet_id_new_settings_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package esi
     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 easyjson955c47c3DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *PutFleetsFleetIdNewSettingsList) {
    22  	isTopLevel := in.IsStart()
    23  	if in.IsNull() {
    24  		in.Skip()
    25  		*out = nil
    26  	} else {
    27  		in.Delim('[')
    28  		if *out == nil {
    29  			if !in.IsDelim(']') {
    30  				*out = make(PutFleetsFleetIdNewSettingsList, 0, 2)
    31  			} else {
    32  				*out = PutFleetsFleetIdNewSettingsList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 PutFleetsFleetIdNewSettings
    39  			(v1).UnmarshalEasyJSON(in)
    40  			*out = append(*out, v1)
    41  			in.WantComma()
    42  		}
    43  		in.Delim(']')
    44  	}
    45  	if isTopLevel {
    46  		in.Consumed()
    47  	}
    48  }
    49  func easyjson955c47c3EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in PutFleetsFleetIdNewSettingsList) {
    50  	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
    51  		out.RawString("null")
    52  	} else {
    53  		out.RawByte('[')
    54  		for v2, v3 := range in {
    55  			if v2 > 0 {
    56  				out.RawByte(',')
    57  			}
    58  			(v3).MarshalEasyJSON(out)
    59  		}
    60  		out.RawByte(']')
    61  	}
    62  }
    63  
    64  // MarshalJSON supports json.Marshaler interface
    65  func (v PutFleetsFleetIdNewSettingsList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson955c47c3EncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v PutFleetsFleetIdNewSettingsList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson955c47c3EncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *PutFleetsFleetIdNewSettingsList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson955c47c3DecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *PutFleetsFleetIdNewSettingsList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson955c47c3DecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson955c47c3DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *PutFleetsFleetIdNewSettings) {
    88  	isTopLevel := in.IsStart()
    89  	if in.IsNull() {
    90  		if isTopLevel {
    91  			in.Consumed()
    92  		}
    93  		in.Skip()
    94  		return
    95  	}
    96  	in.Delim('{')
    97  	for !in.IsDelim('}') {
    98  		key := in.UnsafeFieldName(false)
    99  		in.WantColon()
   100  		if in.IsNull() {
   101  			in.Skip()
   102  			in.WantComma()
   103  			continue
   104  		}
   105  		switch key {
   106  		case "is_free_move":
   107  			out.IsFreeMove = bool(in.Bool())
   108  		case "motd":
   109  			out.Motd = string(in.String())
   110  		default:
   111  			in.SkipRecursive()
   112  		}
   113  		in.WantComma()
   114  	}
   115  	in.Delim('}')
   116  	if isTopLevel {
   117  		in.Consumed()
   118  	}
   119  }
   120  func easyjson955c47c3EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in PutFleetsFleetIdNewSettings) {
   121  	out.RawByte('{')
   122  	first := true
   123  	_ = first
   124  	if in.IsFreeMove {
   125  		const prefix string = ",\"is_free_move\":"
   126  		first = false
   127  		out.RawString(prefix[1:])
   128  		out.Bool(bool(in.IsFreeMove))
   129  	}
   130  	if in.Motd != "" {
   131  		const prefix string = ",\"motd\":"
   132  		if first {
   133  			first = false
   134  			out.RawString(prefix[1:])
   135  		} else {
   136  			out.RawString(prefix)
   137  		}
   138  		out.String(string(in.Motd))
   139  	}
   140  	out.RawByte('}')
   141  }
   142  
   143  // MarshalJSON supports json.Marshaler interface
   144  func (v PutFleetsFleetIdNewSettings) MarshalJSON() ([]byte, error) {
   145  	w := jwriter.Writer{}
   146  	easyjson955c47c3EncodeGithubComAntihaxGoesiEsi1(&w, v)
   147  	return w.Buffer.BuildBytes(), w.Error
   148  }
   149  
   150  // MarshalEasyJSON supports easyjson.Marshaler interface
   151  func (v PutFleetsFleetIdNewSettings) MarshalEasyJSON(w *jwriter.Writer) {
   152  	easyjson955c47c3EncodeGithubComAntihaxGoesiEsi1(w, v)
   153  }
   154  
   155  // UnmarshalJSON supports json.Unmarshaler interface
   156  func (v *PutFleetsFleetIdNewSettings) UnmarshalJSON(data []byte) error {
   157  	r := jlexer.Lexer{Data: data}
   158  	easyjson955c47c3DecodeGithubComAntihaxGoesiEsi1(&r, v)
   159  	return r.Error()
   160  }
   161  
   162  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   163  func (v *PutFleetsFleetIdNewSettings) UnmarshalEasyJSON(l *jlexer.Lexer) {
   164  	easyjson955c47c3DecodeGithubComAntihaxGoesiEsi1(l, v)
   165  }