~bigbes/tarantool

tarantool-protobuf

ref: 117c6ef9c9919d3c49dc1712df9f3b604fdb607b tarantool-protobuf/examples/expected/runtime/proto2_basic/proto2_basic_pb.lua -rw-r--r-- 22.3 KiB
117c6ef9 — Eugene Blikh codegen: type-elision for sint64/fixed64/sfixed64 encode (a7l) 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
-- Code generated by protoc-gen-tarantool. DO NOT EDIT.
-- source: proto2_basic.proto
-- syntax: proto2
-- package: proto2_basic

local pb = require("pb")
local wire = pb.wire
local string_byte = string.byte
local utf8_len = require('utf8').len
local band = bit.band
local rshift = bit.rshift
local CHARS = wire.CHARS
local table_new = require('table.new')
local ffi = require('ffi')
local INT64  = ffi.typeof('int64_t')
local UINT64 = ffi.typeof('uint64_t')

local M = {}

M.options = {go_package = "tarantoolpb_synthetic/proto2_basic"}

-- Enum: proto2_basic.Defaults.Color
M.Defaults_Color_descriptor = pb.enum("proto2_basic.Defaults.Color", {
    RED = 0,
    GREEN = 1,
    BLUE = 2,
})
M.Defaults_Color_descriptor.closed = true
M.Defaults_Color = M.Defaults_Color_descriptor.by_name

-- Pre-declare message descriptors so cross-references resolve.
M.Defaults_descriptor = {name = "proto2_basic.Defaults"}
M.Cardinality_descriptor = {name = "proto2_basic.Cardinality"}
M.Nested_descriptor = {name = "proto2_basic.Nested"}
M.Nested_Inner_descriptor = {name = "proto2_basic.Nested.Inner"}
M.WithGroup_descriptor = {name = "proto2_basic.WithGroup"}
M.WithGroup_SingleGroup_descriptor = {name = "proto2_basic.WithGroup.SingleGroup"}
M.WithGroup_RepGroup_descriptor = {name = "proto2_basic.WithGroup.RepGroup"}
M.BenchPayload_descriptor = {name = "proto2_basic.BenchPayload"}
M.BenchPayload_Stats_descriptor = {name = "proto2_basic.BenchPayload.Stats"}
M.BenchPayload_Inner_descriptor = {name = "proto2_basic.BenchPayload.Inner"}

-- Message: proto2_basic.Defaults
M.Defaults_descriptor.fields = {
    {name="i", id=1, kind='scalar', proto_type="int32", optional=true, default_value=17},
    {name="s", id=2, kind='scalar', proto_type="string", optional=true, default_value="hello"},
    {name="b", id=3, kind='scalar', proto_type="bool", optional=true, default_value=true},
    {name="f", id=4, kind='scalar', proto_type="float", optional=true, default_value=3.5},
    {name="d", id=5, kind='scalar', proto_type="double", optional=true, default_value=1.5},
    {name="i64", id=6, kind='scalar', proto_type="int64", optional=true, default_value=1234567890123LL},
    {name="u64", id=7, kind='scalar', proto_type="uint64", optional=true, default_value=17ULL},
    {name="by", id=8, kind='scalar', proto_type="bytes", optional=true, default_value="\x00\xff"},
    {name="color", id=9, kind='enum', enum=M.Defaults_Color_descriptor, optional=true, default_value="GREEN"},
}
pb.finalize_message(M.Defaults_descriptor)
M.Defaults_fields = pb.field_names({
    i = "i",
    s = "s",
    b = "b",
    f = "f",
    d = "d",
    i64 = "i64",
    u64 = "u64",
    by = "by",
    color = "color",
})

-- Message: proto2_basic.Cardinality
M.Cardinality_descriptor.fields = {
    {name="r", id=1, kind='scalar', proto_type="int32", required=true},
    {name="o", id=2, kind='scalar', proto_type="int32", optional=true},
    {name="packed_default", id=3, kind='scalar', proto_type="int32", repeated=true, packed=false},
    {name="explicitly_packed", id=4, kind='scalar', proto_type="int32", repeated=true, packed=true, options={packed = true}},
    {name="explicitly_unpacked", id=5, kind='scalar', proto_type="int32", repeated=true, packed=false, options={packed = false}},
}
pb.finalize_message(M.Cardinality_descriptor)
M.Cardinality_fields = pb.field_names({
    r = "r",
    o = "o",
    packed_default = "packed_default",
    explicitly_packed = "explicitly_packed",
    explicitly_unpacked = "explicitly_unpacked",
})

-- Message: proto2_basic.Nested
M.Nested_descriptor.fields = {
    {name="inner", id=1, kind='message', message=M.Nested_Inner_descriptor, required=true},
    {name="inner_opt", id=2, kind='message', message=M.Nested_Inner_descriptor, optional=true},
}
pb.finalize_message(M.Nested_descriptor)
M.Nested_fields = pb.field_names({
    inner = "inner",
    inner_opt = "inner_opt",
})

-- Message: proto2_basic.Nested.Inner
M.Nested_Inner_descriptor.fields = {
    {name="x", id=1, kind='scalar', proto_type="int32", required=true},
}
pb.finalize_message(M.Nested_Inner_descriptor)
M.Nested_Inner_fields = pb.field_names({
    x = "x",
})

-- Message: proto2_basic.WithGroup
M.WithGroup_descriptor.fields = {
    {name="singlegroup", id=1, kind='group', message=M.WithGroup_SingleGroup_descriptor, optional=true},
    {name="repgroup", id=4, kind='group', message=M.WithGroup_RepGroup_descriptor, repeated=true},
}
pb.finalize_message(M.WithGroup_descriptor)
M.WithGroup_fields = pb.field_names({
    singlegroup = "singlegroup",
    repgroup = "repgroup",
})

-- Message: proto2_basic.WithGroup.SingleGroup
M.WithGroup_SingleGroup_descriptor.fields = {
    {name="a", id=2, kind='scalar', proto_type="int32", optional=true},
    {name="s", id=3, kind='scalar', proto_type="string", optional=true},
}
pb.finalize_message(M.WithGroup_SingleGroup_descriptor)
M.WithGroup_SingleGroup_fields = pb.field_names({
    a = "a",
    s = "s",
})

-- Message: proto2_basic.WithGroup.RepGroup
M.WithGroup_RepGroup_descriptor.fields = {
    {name="n", id=5, kind='scalar', proto_type="int32", optional=true},
}
pb.finalize_message(M.WithGroup_RepGroup_descriptor)
M.WithGroup_RepGroup_fields = pb.field_names({
    n = "n",
})

-- Message: proto2_basic.BenchPayload
M.BenchPayload_descriptor.fields = {
    {name="id", id=1, kind='scalar', proto_type="int32", required=true},
    {name="name", id=2, kind='scalar', proto_type="string", optional=true, default_value="anonymous"},
    {name="retries", id=3, kind='scalar', proto_type="int32", optional=true, default_value=3},
    {name="lucky_numbers", id=4, kind='scalar', proto_type="int32", repeated=true, packed=true, options={packed = true}},
    {name="tags", id=5, kind='scalar', proto_type="string", repeated=true},
    {name="inner", id=6, kind='message', message=M.BenchPayload_Inner_descriptor, optional=true},
    {name="stats", id=7, kind='group', message=M.BenchPayload_Stats_descriptor, optional=true},
}
pb.finalize_message(M.BenchPayload_descriptor)
M.BenchPayload_fields = pb.field_names({
    id = "id",
    name = "name",
    retries = "retries",
    lucky_numbers = "lucky_numbers",
    tags = "tags",
    inner = "inner",
    stats = "stats",
})

-- Message: proto2_basic.BenchPayload.Stats
M.BenchPayload_Stats_descriptor.fields = {
    {name="latency_ns", id=8, kind='scalar', proto_type="int32", optional=true},
    {name="attempts", id=9, kind='scalar', proto_type="int32", optional=true},
}
pb.finalize_message(M.BenchPayload_Stats_descriptor)
M.BenchPayload_Stats_fields = pb.field_names({
    latency_ns = "latency_ns",
    attempts = "attempts",
})

-- Message: proto2_basic.BenchPayload.Inner
M.BenchPayload_Inner_descriptor.fields = {
    {name="key", id=1, kind='scalar', proto_type="string", required=true},
    {name="weight", id=2, kind='scalar', proto_type="int32", optional=true},
}
pb.finalize_message(M.BenchPayload_Inner_descriptor)
M.BenchPayload_Inner_fields = pb.field_names({
    key = "key",
    weight = "weight",
})

-- EmmyLua / lua-language-server type annotations.
-- These are comments — no runtime effect. They give editors
-- autocomplete and type-checking for the generated wrappers.
---@alias proto2_basic.Defaults.Color integer

---@class proto2_basic.Defaults
---@field i? integer
---@field s? string
---@field b? boolean
---@field f? number
---@field d? number
---@field i64? integer
---@field u64? integer
---@field by? string
---@field color? proto2_basic.Defaults.Color

---@class proto2_basic.Cardinality
---@field r integer
---@field o? integer
---@field packed_default integer[]
---@field explicitly_packed integer[]
---@field explicitly_unpacked integer[]

---@class proto2_basic.Nested
---@field inner proto2_basic.Nested.Inner
---@field inner_opt? proto2_basic.Nested.Inner

---@class proto2_basic.Nested.Inner
---@field x integer

--- Proto2 legacy groups. Wire format uses SGROUP (3) / EGROUP (4) tag
--- pairs instead of a length-prefixed message body.
---@class proto2_basic.WithGroup
---@field singlegroup? proto2_basic.WithGroup.SingleGroup
---@field repgroup proto2_basic.WithGroup.RepGroup[]

---@class proto2_basic.WithGroup.SingleGroup
---@field a? integer
---@field s? string

---@class proto2_basic.WithGroup.RepGroup
---@field n? integer

--- Bench fixture exercising the proto2-only shapes: required scalar,
--- optional repeated, custom default, a `group` field, and a nested
--- message. Used by bench/bench.lua against both modes.
---@class proto2_basic.BenchPayload
---@field id integer
---@field name? string
---@field retries? integer
---@field lucky_numbers integer[]
---@field tags string[]
---@field inner? proto2_basic.BenchPayload.Inner
---@field stats? proto2_basic.BenchPayload.Stats

---@class proto2_basic.BenchPayload.Stats
---@field latency_ns? integer
---@field attempts? integer

---@class proto2_basic.BenchPayload.Inner
---@field key string
---@field weight? integer

---@param t? proto2_basic.Defaults
---@return proto2_basic.Defaults
function M.Defaults_new(t) return t or {} end
---@param t proto2_basic.Defaults
---@return string
function M.Defaults_encode(t) return pb.encode(M.Defaults_descriptor, t) end
---@param b string
---@return proto2_basic.Defaults
function M.Defaults_decode(b) return pb.decode(M.Defaults_descriptor, b) end
function M.Defaults_decode_unsafe(b) return pb.decode_unsafe(M.Defaults_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.Defaults_decode_lazy(b) return pb.decode_lazy(M.Defaults_descriptor, b) end
---@param t proto2_basic.Defaults
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Defaults_text(t, opts) return pb.text.encode(M.Defaults_descriptor, t, opts) end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_i(t) return t.i ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_i(t) t.i = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_s(t) return t.s ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_s(t) t.s = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_b(t) return t.b ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_b(t) t.b = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_f(t) return t.f ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_f(t) t.f = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_d(t) return t.d ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_d(t) t.d = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_i64(t) return t.i64 ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_i64(t) t.i64 = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_u64(t) return t.u64 ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_u64(t) t.u64 = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_by(t) return t.by ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_by(t) t.by = nil end
---@param t proto2_basic.Defaults
---@return boolean
function M.Defaults_has_color(t) return t.color ~= nil end
---@param t proto2_basic.Defaults
function M.Defaults_clear_color(t) t.color = nil end

---@param t? proto2_basic.Cardinality
---@return proto2_basic.Cardinality
function M.Cardinality_new(t) return t or {} end
---@param t proto2_basic.Cardinality
---@return string
function M.Cardinality_encode(t) return pb.encode(M.Cardinality_descriptor, t) end
---@param b string
---@return proto2_basic.Cardinality
function M.Cardinality_decode(b) return pb.decode(M.Cardinality_descriptor, b) end
function M.Cardinality_decode_unsafe(b) return pb.decode_unsafe(M.Cardinality_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.Cardinality_decode_lazy(b) return pb.decode_lazy(M.Cardinality_descriptor, b) end
---@param t proto2_basic.Cardinality
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Cardinality_text(t, opts) return pb.text.encode(M.Cardinality_descriptor, t, opts) end
---@param t proto2_basic.Cardinality
---@return boolean
function M.Cardinality_has_o(t) return t.o ~= nil end
---@param t proto2_basic.Cardinality
function M.Cardinality_clear_o(t) t.o = nil end

---@param t? proto2_basic.Nested
---@return proto2_basic.Nested
function M.Nested_new(t) return t or {} end
---@param t proto2_basic.Nested
---@return string
function M.Nested_encode(t) return pb.encode(M.Nested_descriptor, t) end
---@param b string
---@return proto2_basic.Nested
function M.Nested_decode(b) return pb.decode(M.Nested_descriptor, b) end
function M.Nested_decode_unsafe(b) return pb.decode_unsafe(M.Nested_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.Nested_decode_lazy(b) return pb.decode_lazy(M.Nested_descriptor, b) end
---@param t proto2_basic.Nested
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Nested_text(t, opts) return pb.text.encode(M.Nested_descriptor, t, opts) end
---@param t proto2_basic.Nested
---@return boolean
function M.Nested_has_inner_opt(t) return t.inner_opt ~= nil end
---@param t proto2_basic.Nested
function M.Nested_clear_inner_opt(t) t.inner_opt = nil end

---@param t? proto2_basic.Nested.Inner
---@return proto2_basic.Nested.Inner
function M.Nested_Inner_new(t) return t or {} end
---@param t proto2_basic.Nested.Inner
---@return string
function M.Nested_Inner_encode(t) return pb.encode(M.Nested_Inner_descriptor, t) end
---@param b string
---@return proto2_basic.Nested.Inner
function M.Nested_Inner_decode(b) return pb.decode(M.Nested_Inner_descriptor, b) end
function M.Nested_Inner_decode_unsafe(b) return pb.decode_unsafe(M.Nested_Inner_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.Nested_Inner_decode_lazy(b) return pb.decode_lazy(M.Nested_Inner_descriptor, b) end
---@param t proto2_basic.Nested.Inner
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Nested_Inner_text(t, opts) return pb.text.encode(M.Nested_Inner_descriptor, t, opts) end

---@param t? proto2_basic.WithGroup
---@return proto2_basic.WithGroup
function M.WithGroup_new(t) return t or {} end
---@param t proto2_basic.WithGroup
---@return string
function M.WithGroup_encode(t) return pb.encode(M.WithGroup_descriptor, t) end
---@param b string
---@return proto2_basic.WithGroup
function M.WithGroup_decode(b) return pb.decode(M.WithGroup_descriptor, b) end
function M.WithGroup_decode_unsafe(b) return pb.decode_unsafe(M.WithGroup_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.WithGroup_decode_lazy(b) return pb.decode_lazy(M.WithGroup_descriptor, b) end
---@param t proto2_basic.WithGroup
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.WithGroup_text(t, opts) return pb.text.encode(M.WithGroup_descriptor, t, opts) end
---@param t proto2_basic.WithGroup
---@return boolean
function M.WithGroup_has_singlegroup(t) return t.singlegroup ~= nil end
---@param t proto2_basic.WithGroup
function M.WithGroup_clear_singlegroup(t) t.singlegroup = nil end

---@param t? proto2_basic.WithGroup.SingleGroup
---@return proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_new(t) return t or {} end
---@param t proto2_basic.WithGroup.SingleGroup
---@return string
function M.WithGroup_SingleGroup_encode(t) return pb.encode(M.WithGroup_SingleGroup_descriptor, t) end
---@param b string
---@return proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_decode(b) return pb.decode(M.WithGroup_SingleGroup_descriptor, b) end
function M.WithGroup_SingleGroup_decode_unsafe(b) return pb.decode_unsafe(M.WithGroup_SingleGroup_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.WithGroup_SingleGroup_decode_lazy(b) return pb.decode_lazy(M.WithGroup_SingleGroup_descriptor, b) end
---@param t proto2_basic.WithGroup.SingleGroup
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.WithGroup_SingleGroup_text(t, opts) return pb.text.encode(M.WithGroup_SingleGroup_descriptor, t, opts) end
---@param t proto2_basic.WithGroup.SingleGroup
---@return boolean
function M.WithGroup_SingleGroup_has_a(t) return t.a ~= nil end
---@param t proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_clear_a(t) t.a = nil end
---@param t proto2_basic.WithGroup.SingleGroup
---@return boolean
function M.WithGroup_SingleGroup_has_s(t) return t.s ~= nil end
---@param t proto2_basic.WithGroup.SingleGroup
function M.WithGroup_SingleGroup_clear_s(t) t.s = nil end

---@param t? proto2_basic.WithGroup.RepGroup
---@return proto2_basic.WithGroup.RepGroup
function M.WithGroup_RepGroup_new(t) return t or {} end
---@param t proto2_basic.WithGroup.RepGroup
---@return string
function M.WithGroup_RepGroup_encode(t) return pb.encode(M.WithGroup_RepGroup_descriptor, t) end
---@param b string
---@return proto2_basic.WithGroup.RepGroup
function M.WithGroup_RepGroup_decode(b) return pb.decode(M.WithGroup_RepGroup_descriptor, b) end
function M.WithGroup_RepGroup_decode_unsafe(b) return pb.decode_unsafe(M.WithGroup_RepGroup_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.WithGroup_RepGroup_decode_lazy(b) return pb.decode_lazy(M.WithGroup_RepGroup_descriptor, b) end
---@param t proto2_basic.WithGroup.RepGroup
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.WithGroup_RepGroup_text(t, opts) return pb.text.encode(M.WithGroup_RepGroup_descriptor, t, opts) end
---@param t proto2_basic.WithGroup.RepGroup
---@return boolean
function M.WithGroup_RepGroup_has_n(t) return t.n ~= nil end
---@param t proto2_basic.WithGroup.RepGroup
function M.WithGroup_RepGroup_clear_n(t) t.n = nil end

---@param t? proto2_basic.BenchPayload
---@return proto2_basic.BenchPayload
function M.BenchPayload_new(t) return t or {} end
---@param t proto2_basic.BenchPayload
---@return string
function M.BenchPayload_encode(t) return pb.encode(M.BenchPayload_descriptor, t) end
---@param b string
---@return proto2_basic.BenchPayload
function M.BenchPayload_decode(b) return pb.decode(M.BenchPayload_descriptor, b) end
function M.BenchPayload_decode_unsafe(b) return pb.decode_unsafe(M.BenchPayload_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.BenchPayload_decode_lazy(b) return pb.decode_lazy(M.BenchPayload_descriptor, b) end
---@param t proto2_basic.BenchPayload
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.BenchPayload_text(t, opts) return pb.text.encode(M.BenchPayload_descriptor, t, opts) end
---@param t proto2_basic.BenchPayload
---@return boolean
function M.BenchPayload_has_name(t) return t.name ~= nil end
---@param t proto2_basic.BenchPayload
function M.BenchPayload_clear_name(t) t.name = nil end
---@param t proto2_basic.BenchPayload
---@return boolean
function M.BenchPayload_has_retries(t) return t.retries ~= nil end
---@param t proto2_basic.BenchPayload
function M.BenchPayload_clear_retries(t) t.retries = nil end
---@param t proto2_basic.BenchPayload
---@return boolean
function M.BenchPayload_has_inner(t) return t.inner ~= nil end
---@param t proto2_basic.BenchPayload
function M.BenchPayload_clear_inner(t) t.inner = nil end
---@param t proto2_basic.BenchPayload
---@return boolean
function M.BenchPayload_has_stats(t) return t.stats ~= nil end
---@param t proto2_basic.BenchPayload
function M.BenchPayload_clear_stats(t) t.stats = nil end

---@param t? proto2_basic.BenchPayload.Stats
---@return proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_new(t) return t or {} end
---@param t proto2_basic.BenchPayload.Stats
---@return string
function M.BenchPayload_Stats_encode(t) return pb.encode(M.BenchPayload_Stats_descriptor, t) end
---@param b string
---@return proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_decode(b) return pb.decode(M.BenchPayload_Stats_descriptor, b) end
function M.BenchPayload_Stats_decode_unsafe(b) return pb.decode_unsafe(M.BenchPayload_Stats_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.BenchPayload_Stats_decode_lazy(b) return pb.decode_lazy(M.BenchPayload_Stats_descriptor, b) end
---@param t proto2_basic.BenchPayload.Stats
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.BenchPayload_Stats_text(t, opts) return pb.text.encode(M.BenchPayload_Stats_descriptor, t, opts) end
---@param t proto2_basic.BenchPayload.Stats
---@return boolean
function M.BenchPayload_Stats_has_latency_ns(t) return t.latency_ns ~= nil end
---@param t proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_clear_latency_ns(t) t.latency_ns = nil end
---@param t proto2_basic.BenchPayload.Stats
---@return boolean
function M.BenchPayload_Stats_has_attempts(t) return t.attempts ~= nil end
---@param t proto2_basic.BenchPayload.Stats
function M.BenchPayload_Stats_clear_attempts(t) t.attempts = nil end

---@param t? proto2_basic.BenchPayload.Inner
---@return proto2_basic.BenchPayload.Inner
function M.BenchPayload_Inner_new(t) return t or {} end
---@param t proto2_basic.BenchPayload.Inner
---@return string
function M.BenchPayload_Inner_encode(t) return pb.encode(M.BenchPayload_Inner_descriptor, t) end
---@param b string
---@return proto2_basic.BenchPayload.Inner
function M.BenchPayload_Inner_decode(b) return pb.decode(M.BenchPayload_Inner_descriptor, b) end
function M.BenchPayload_Inner_decode_unsafe(b) return pb.decode_unsafe(M.BenchPayload_Inner_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.BenchPayload_Inner_decode_lazy(b) return pb.decode_lazy(M.BenchPayload_Inner_descriptor, b) end
---@param t proto2_basic.BenchPayload.Inner
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.BenchPayload_Inner_text(t, opts) return pb.text.encode(M.BenchPayload_Inner_descriptor, t, opts) end
---@param t proto2_basic.BenchPayload.Inner
---@return boolean
function M.BenchPayload_Inner_has_weight(t) return t.weight ~= nil end
---@param t proto2_basic.BenchPayload.Inner
function M.BenchPayload_Inner_clear_weight(t) t.weight = nil end

-- Extension: proto2_basic.ext_count extends proto2_basic.BenchPayload (tag 100)
pb.register_extension(M.BenchPayload_descriptor, {name="ext_count", full_name="proto2_basic.ext_count", id=100, kind='scalar', proto_type="int32", optional=true})
-- Extension: proto2_basic.ext_label extends proto2_basic.BenchPayload (tag 101)
pb.register_extension(M.BenchPayload_descriptor, {name="ext_label", full_name="proto2_basic.ext_label", id=101, kind='scalar', proto_type="string", optional=true})

return M