easyjson.go 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package headlessexperimental
  3. import (
  4. json "encoding/json"
  5. easyjson "github.com/mailru/easyjson"
  6. jlexer "github.com/mailru/easyjson/jlexer"
  7. jwriter "github.com/mailru/easyjson/jwriter"
  8. )
  9. // suppress unused package warning
  10. var (
  11. _ *json.RawMessage
  12. _ *jlexer.Lexer
  13. _ *jwriter.Writer
  14. _ easyjson.Marshaler
  15. )
  16. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(in *jlexer.Lexer, out *ScreenshotParams) {
  17. isTopLevel := in.IsStart()
  18. if in.IsNull() {
  19. if isTopLevel {
  20. in.Consumed()
  21. }
  22. in.Skip()
  23. return
  24. }
  25. in.Delim('{')
  26. for !in.IsDelim('}') {
  27. key := in.UnsafeFieldName(false)
  28. in.WantColon()
  29. if in.IsNull() {
  30. in.Skip()
  31. in.WantComma()
  32. continue
  33. }
  34. switch key {
  35. case "format":
  36. (out.Format).UnmarshalEasyJSON(in)
  37. case "quality":
  38. out.Quality = int64(in.Int64())
  39. case "optimizeForSpeed":
  40. out.OptimizeForSpeed = bool(in.Bool())
  41. default:
  42. in.SkipRecursive()
  43. }
  44. in.WantComma()
  45. }
  46. in.Delim('}')
  47. if isTopLevel {
  48. in.Consumed()
  49. }
  50. }
  51. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(out *jwriter.Writer, in ScreenshotParams) {
  52. out.RawByte('{')
  53. first := true
  54. _ = first
  55. if in.Format != "" {
  56. const prefix string = ",\"format\":"
  57. first = false
  58. out.RawString(prefix[1:])
  59. (in.Format).MarshalEasyJSON(out)
  60. }
  61. if in.Quality != 0 {
  62. const prefix string = ",\"quality\":"
  63. if first {
  64. first = false
  65. out.RawString(prefix[1:])
  66. } else {
  67. out.RawString(prefix)
  68. }
  69. out.Int64(int64(in.Quality))
  70. }
  71. if in.OptimizeForSpeed {
  72. const prefix string = ",\"optimizeForSpeed\":"
  73. if first {
  74. first = false
  75. out.RawString(prefix[1:])
  76. } else {
  77. out.RawString(prefix)
  78. }
  79. out.Bool(bool(in.OptimizeForSpeed))
  80. }
  81. out.RawByte('}')
  82. }
  83. // MarshalJSON supports json.Marshaler interface
  84. func (v ScreenshotParams) MarshalJSON() ([]byte, error) {
  85. w := jwriter.Writer{}
  86. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(&w, v)
  87. return w.Buffer.BuildBytes(), w.Error
  88. }
  89. // MarshalEasyJSON supports easyjson.Marshaler interface
  90. func (v ScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) {
  91. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental(w, v)
  92. }
  93. // UnmarshalJSON supports json.Unmarshaler interface
  94. func (v *ScreenshotParams) UnmarshalJSON(data []byte) error {
  95. r := jlexer.Lexer{Data: data}
  96. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(&r, v)
  97. return r.Error()
  98. }
  99. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  100. func (v *ScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
  101. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental(l, v)
  102. }
  103. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(in *jlexer.Lexer, out *BeginFrameReturns) {
  104. isTopLevel := in.IsStart()
  105. if in.IsNull() {
  106. if isTopLevel {
  107. in.Consumed()
  108. }
  109. in.Skip()
  110. return
  111. }
  112. in.Delim('{')
  113. for !in.IsDelim('}') {
  114. key := in.UnsafeFieldName(false)
  115. in.WantColon()
  116. if in.IsNull() {
  117. in.Skip()
  118. in.WantComma()
  119. continue
  120. }
  121. switch key {
  122. case "hasDamage":
  123. out.HasDamage = bool(in.Bool())
  124. case "screenshotData":
  125. out.ScreenshotData = string(in.String())
  126. default:
  127. in.SkipRecursive()
  128. }
  129. in.WantComma()
  130. }
  131. in.Delim('}')
  132. if isTopLevel {
  133. in.Consumed()
  134. }
  135. }
  136. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(out *jwriter.Writer, in BeginFrameReturns) {
  137. out.RawByte('{')
  138. first := true
  139. _ = first
  140. if in.HasDamage {
  141. const prefix string = ",\"hasDamage\":"
  142. first = false
  143. out.RawString(prefix[1:])
  144. out.Bool(bool(in.HasDamage))
  145. }
  146. if in.ScreenshotData != "" {
  147. const prefix string = ",\"screenshotData\":"
  148. if first {
  149. first = false
  150. out.RawString(prefix[1:])
  151. } else {
  152. out.RawString(prefix)
  153. }
  154. out.String(string(in.ScreenshotData))
  155. }
  156. out.RawByte('}')
  157. }
  158. // MarshalJSON supports json.Marshaler interface
  159. func (v BeginFrameReturns) MarshalJSON() ([]byte, error) {
  160. w := jwriter.Writer{}
  161. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(&w, v)
  162. return w.Buffer.BuildBytes(), w.Error
  163. }
  164. // MarshalEasyJSON supports easyjson.Marshaler interface
  165. func (v BeginFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
  166. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1(w, v)
  167. }
  168. // UnmarshalJSON supports json.Unmarshaler interface
  169. func (v *BeginFrameReturns) UnmarshalJSON(data []byte) error {
  170. r := jlexer.Lexer{Data: data}
  171. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(&r, v)
  172. return r.Error()
  173. }
  174. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  175. func (v *BeginFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
  176. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental1(l, v)
  177. }
  178. func easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(in *jlexer.Lexer, out *BeginFrameParams) {
  179. isTopLevel := in.IsStart()
  180. if in.IsNull() {
  181. if isTopLevel {
  182. in.Consumed()
  183. }
  184. in.Skip()
  185. return
  186. }
  187. in.Delim('{')
  188. for !in.IsDelim('}') {
  189. key := in.UnsafeFieldName(false)
  190. in.WantColon()
  191. if in.IsNull() {
  192. in.Skip()
  193. in.WantComma()
  194. continue
  195. }
  196. switch key {
  197. case "frameTimeTicks":
  198. out.FrameTimeTicks = float64(in.Float64())
  199. case "interval":
  200. out.Interval = float64(in.Float64())
  201. case "noDisplayUpdates":
  202. out.NoDisplayUpdates = bool(in.Bool())
  203. case "screenshot":
  204. if in.IsNull() {
  205. in.Skip()
  206. out.Screenshot = nil
  207. } else {
  208. if out.Screenshot == nil {
  209. out.Screenshot = new(ScreenshotParams)
  210. }
  211. (*out.Screenshot).UnmarshalEasyJSON(in)
  212. }
  213. default:
  214. in.SkipRecursive()
  215. }
  216. in.WantComma()
  217. }
  218. in.Delim('}')
  219. if isTopLevel {
  220. in.Consumed()
  221. }
  222. }
  223. func easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(out *jwriter.Writer, in BeginFrameParams) {
  224. out.RawByte('{')
  225. first := true
  226. _ = first
  227. if in.FrameTimeTicks != 0 {
  228. const prefix string = ",\"frameTimeTicks\":"
  229. first = false
  230. out.RawString(prefix[1:])
  231. out.Float64(float64(in.FrameTimeTicks))
  232. }
  233. if in.Interval != 0 {
  234. const prefix string = ",\"interval\":"
  235. if first {
  236. first = false
  237. out.RawString(prefix[1:])
  238. } else {
  239. out.RawString(prefix)
  240. }
  241. out.Float64(float64(in.Interval))
  242. }
  243. if in.NoDisplayUpdates {
  244. const prefix string = ",\"noDisplayUpdates\":"
  245. if first {
  246. first = false
  247. out.RawString(prefix[1:])
  248. } else {
  249. out.RawString(prefix)
  250. }
  251. out.Bool(bool(in.NoDisplayUpdates))
  252. }
  253. if in.Screenshot != nil {
  254. const prefix string = ",\"screenshot\":"
  255. if first {
  256. first = false
  257. out.RawString(prefix[1:])
  258. } else {
  259. out.RawString(prefix)
  260. }
  261. (*in.Screenshot).MarshalEasyJSON(out)
  262. }
  263. out.RawByte('}')
  264. }
  265. // MarshalJSON supports json.Marshaler interface
  266. func (v BeginFrameParams) MarshalJSON() ([]byte, error) {
  267. w := jwriter.Writer{}
  268. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(&w, v)
  269. return w.Buffer.BuildBytes(), w.Error
  270. }
  271. // MarshalEasyJSON supports easyjson.Marshaler interface
  272. func (v BeginFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
  273. easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental2(w, v)
  274. }
  275. // UnmarshalJSON supports json.Unmarshaler interface
  276. func (v *BeginFrameParams) UnmarshalJSON(data []byte) error {
  277. r := jlexer.Lexer{Data: data}
  278. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(&r, v)
  279. return r.Error()
  280. }
  281. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  282. func (v *BeginFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
  283. easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeadlessexperimental2(l, v)
  284. }