-- Code generated by protoc-gen-tarantool. DO NOT EDIT.
-- source: c_repeated.proto
-- syntax: proto3
-- package: c_repeated
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 M = {}
M.options = {go_package = "tarantoolpb_synthetic/c_repeated"}
-- Pre-declare message descriptors so cross-references resolve.
M.Inner_descriptor = {name = "c_repeated.Inner"}
M.Holder_descriptor = {name = "c_repeated.Holder"}
-- Message: c_repeated.Inner
M.Inner_descriptor.fields = {
{name="v", id=1, kind='scalar', proto_type="int32"},
{name="s", id=2, kind='scalar', proto_type="string"},
}
pb.finalize_message(M.Inner_descriptor)
M.Inner_fields = pb.field_names({
v = "v",
s = "s",
})
-- Message: c_repeated.Holder
M.Holder_descriptor.fields = {
{name="packed_int32", id=1, kind='scalar', proto_type="int32", repeated=true, packed=true},
{name="packed_int64", id=2, kind='scalar', proto_type="int64", repeated=true, packed=true},
{name="packed_sint32", id=3, kind='scalar', proto_type="sint32", repeated=true, packed=true},
{name="packed_uint32", id=4, kind='scalar', proto_type="uint32", repeated=true, packed=true},
{name="packed_fixed32", id=5, kind='scalar', proto_type="fixed32", repeated=true, packed=true},
{name="packed_fixed64", id=6, kind='scalar', proto_type="fixed64", repeated=true, packed=true},
{name="packed_double", id=7, kind='scalar', proto_type="double", repeated=true, packed=true},
{name="packed_float", id=8, kind='scalar', proto_type="float", repeated=true, packed=true},
{name="packed_bool", id=9, kind='scalar', proto_type="bool", repeated=true, packed=true},
{name="unpacked_int32", id=20, kind='scalar', proto_type="int32", repeated=true, packed=false, options={packed = false}},
{name="unpacked_fixed64", id=21, kind='scalar', proto_type="fixed64", repeated=true, packed=false, options={packed = false}},
{name="unpacked_sint32", id=22, kind='scalar', proto_type="sint32", repeated=true, packed=false, options={packed = false}},
{name="strings", id=30, kind='scalar', proto_type="string", repeated=true},
{name="blobs", id=31, kind='scalar', proto_type="bytes", repeated=true},
{name="messages", id=40, kind='message', message=M.Inner_descriptor, repeated=true},
}
pb.finalize_message(M.Holder_descriptor)
M.Holder_fields = pb.field_names({
packed_int32 = "packed_int32",
packed_int64 = "packed_int64",
packed_sint32 = "packed_sint32",
packed_uint32 = "packed_uint32",
packed_fixed32 = "packed_fixed32",
packed_fixed64 = "packed_fixed64",
packed_double = "packed_double",
packed_float = "packed_float",
packed_bool = "packed_bool",
unpacked_int32 = "unpacked_int32",
unpacked_fixed64 = "unpacked_fixed64",
unpacked_sint32 = "unpacked_sint32",
strings = "strings",
blobs = "blobs",
messages = "messages",
})
-- EmmyLua / lua-language-server type annotations.
-- These are comments — no runtime effect. They give editors
-- autocomplete and type-checking for the generated wrappers.
---@class c_repeated.Inner
---@field v integer
---@field s string
---@class c_repeated.Holder
---@field packed_int32 integer[] @ Packed scalars (proto3 default). One per encoder branch.
---@field packed_int64 integer[]
---@field packed_sint32 integer[]
---@field packed_uint32 integer[]
---@field packed_fixed32 integer[]
---@field packed_fixed64 integer[]
---@field packed_double number[]
---@field packed_float number[]
---@field packed_bool boolean[]
---@field unpacked_int32 integer[] @ Explicit unpacked — emits one tag per element.
---@field unpacked_fixed64 integer[]
---@field unpacked_sint32 integer[]
---@field strings string[] @ Length-delimited element kinds — never packable.
---@field blobs string[]
---@field messages c_repeated.Inner[] @ Repeated sub-message — per-element tag + length-prefix + body.
---@param t? c_repeated.Inner
---@return c_repeated.Inner
function M.Inner_new(t) return t or {} end
---@param t c_repeated.Inner
---@return string
function M.Inner_encode(t)
local _d = M.Inner_descriptor
if pb.c_runtime ~= nil then
local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)
return pb.c_runtime.encode(_p, t)
end
if type(t) ~= 'table' then
error("expected table for c_repeated.Inner, got " .. type(t), 0)
end
local out, n = {}, 0
local v
-- field 1: v
v = t.v
if v ~= nil and v ~= 0 then
n = n + 1; out[n] = "\x08"
n = n + 1; out[n] = wire.encode_int32(v)
end
-- field 2: s
v = t.s
if v ~= nil and v ~= '' then
n = n + 1; out[n] = "\x12"
local _len = #v
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = wire.encode_varint(_len)
end
n = n + 1; out[n] = v
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
---@param b string
---@return c_repeated.Inner
function M.Inner_decode(buf)
local _d = M.Inner_descriptor
if pb.c_runtime ~= nil then
local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)
return pb.c_runtime.decode(_p, buf)
end
if type(buf) ~= 'string' then
error("expected string for c_repeated.Inner decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
while pos <= len do
local _tag_start = pos
local id, wt
local _b = string_byte(buf, pos)
if _b ~= nil and _b < 0x80 then
wt = band(_b, 7)
if wt >= 6 then error("illegal wire type " .. wt, 0) end
id = rshift(_b, 3)
if id == 0 then error("illegal field number 0", 0) end
pos = pos + 1
else
id, wt, pos = wire.decode_tag(buf, pos)
end
if id == 1 then
local val
val, pos = wire.decode_int32(buf, pos)
result.v = val
elseif id == 2 then
local _lb = string_byte(buf, pos)
if _lb ~= nil and _lb < 0x80 then
local _np = pos + 1
local _epos = _np + _lb
if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
local _s = buf:sub(_np, _epos - 1)
if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
result.s = _s
pos = _epos
else
local val
val, pos = wire.decode_string(buf, pos)
result.s = val
end
else
local _ebid = M.Inner_descriptor.extensions_by_id
local _ext = _ebid and _ebid[id] or nil
if _ext ~= nil then
pos = pb.codec.decode_extension(_ext, buf, pos, wt, result)
else
pos = wire.skip_field(buf, pos, wt, id)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
---@param b string
---@return pb.MessageView
function M.Inner_decode_lazy(b) return pb.decode_lazy(M.Inner_descriptor, b) end
---@param t c_repeated.Inner
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Inner_text(t, opts) return pb.text.encode(M.Inner_descriptor, t, opts) end
---@param t? c_repeated.Holder
---@return c_repeated.Holder
function M.Holder_new(t) return t or {} end
---@param t c_repeated.Holder
---@return string
function M.Holder_encode(t)
local encode_fixed64 = wire.encode_fixed64
local encode_int32 = wire.encode_int32
local encode_sint32 = wire.encode_sint32
local encode_varint = wire.encode_varint
local _d = M.Holder_descriptor
if pb.c_runtime ~= nil then
local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)
return pb.c_runtime.encode(_p, t)
end
if type(t) ~= 'table' then
error("expected table for c_repeated.Holder, got " .. type(t), 0)
end
local out, n = {}, 0
local v
-- field 1: packed_int32
v = t.packed_int32
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = encode_int32(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x0a"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 2: packed_int64
v = t.packed_int64
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_int64(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x12"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 3: packed_sint32
v = t.packed_sint32
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = encode_sint32(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x1a"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 4: packed_uint32
v = t.packed_uint32
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_uint32(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x22"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 5: packed_fixed32
v = t.packed_fixed32
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_fixed32(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x2a"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 6: packed_fixed64
v = t.packed_fixed64
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = encode_fixed64(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x32"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 7: packed_double
v = t.packed_double
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_double(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x3a"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 8: packed_float
v = t.packed_float
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_float(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x42"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 9: packed_bool
v = t.packed_bool
if v ~= nil and #v > 0 then
local parts, m = {}, 0
for _i = 1, #v do
m = m + 1; parts[m] = wire.encode_bool(v[_i])
end
local _b = table.concat(parts)
n = n + 1; out[n] = "\x4a"
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
-- field 20: unpacked_int32
v = t.unpacked_int32
if v ~= nil and #v > 0 then
local _tag = "\xa0\x01"
for _i = 1, #v do
n = n + 1; out[n] = _tag
n = n + 1; out[n] = encode_int32(v[_i])
end
end
-- field 21: unpacked_fixed64
v = t.unpacked_fixed64
if v ~= nil and #v > 0 then
local _tag = "\xa9\x01"
for _i = 1, #v do
n = n + 1; out[n] = _tag
n = n + 1; out[n] = encode_fixed64(v[_i])
end
end
-- field 22: unpacked_sint32
v = t.unpacked_sint32
if v ~= nil and #v > 0 then
local _tag = "\xb0\x01"
for _i = 1, #v do
n = n + 1; out[n] = _tag
n = n + 1; out[n] = encode_sint32(v[_i])
end
end
-- field 30: strings
v = t.strings
if v ~= nil and #v > 0 then
local _tag = "\xf2\x01"
for _i = 1, #v do
local _b = v[_i]
n = n + 1; out[n] = _tag
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
end
-- field 31: blobs
v = t.blobs
if v ~= nil and #v > 0 then
local _tag = "\xfa\x01"
for _i = 1, #v do
local _b = v[_i]
n = n + 1; out[n] = _tag
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
end
-- field 40: messages
v = t.messages
if v ~= nil and #v > 0 then
local _tag = "\xc2\x02"
for _i = 1, #v do
local _b = M.Inner_encode(v[_i])
n = n + 1; out[n] = _tag
local _len = #_b
if _len < 128 then
n = n + 1; out[n] = CHARS[_len]
else
n = n + 1; out[n] = encode_varint(_len)
end
n = n + 1; out[n] = _b
end
end
local _uf = t._unknown_fields
if _uf ~= nil and _uf ~= '' then n = n + 1; out[n] = _uf end
return table.concat(out)
end
---@param b string
---@return c_repeated.Holder
function M.Holder_decode(buf)
local decode_bool = wire.decode_bool
local decode_double = wire.decode_double
local decode_fixed32 = wire.decode_fixed32
local decode_fixed64 = wire.decode_fixed64
local decode_float = wire.decode_float
local decode_int32 = wire.decode_int32
local decode_int64 = wire.decode_int64
local decode_len = wire.decode_len
local decode_sint32 = wire.decode_sint32
local decode_uint32 = wire.decode_uint32
local _d = M.Holder_descriptor
if pb.c_runtime ~= nil then
local _p = _d.c_plan or pb.c_runtime.compile_plan(_d)
return pb.c_runtime.decode(_p, buf)
end
if type(buf) ~= 'string' then
error("expected string for c_repeated.Holder decode, got " .. type(buf), 0)
end
local result = {}
local pos, len = 1, #buf
local _uf
local _n_packed_int32 = 0
local _n_packed_int64 = 0
local _n_packed_sint32 = 0
local _n_packed_uint32 = 0
local _n_packed_fixed32 = 0
local _n_packed_fixed64 = 0
local _n_packed_double = 0
local _n_packed_float = 0
local _n_packed_bool = 0
local _n_unpacked_int32 = 0
local _n_unpacked_fixed64 = 0
local _n_unpacked_sint32 = 0
local _n_strings = 0
local _n_blobs = 0
local _n_messages = 0
while pos <= len do
local _tag_start = pos
local id, wt
local _b = string_byte(buf, pos)
if _b ~= nil and _b < 0x80 then
wt = band(_b, 7)
if wt >= 6 then error("illegal wire type " .. wt, 0) end
id = rshift(_b, 3)
if id == 0 then error("illegal field number 0", 0) end
pos = pos + 1
else
id, wt, pos = wire.decode_tag(buf, pos)
end
if id == 1 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_int32
if list == nil then list = table_new(lim, 0); result.packed_int32 = list end
while p2 <= lim do
local val
val, p2 = decode_int32(payload, p2)
_n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val
end
else
local list = result.packed_int32
if list == nil then list = {}; result.packed_int32 = list end
local val
val, pos = decode_int32(buf, pos)
_n_packed_int32 = _n_packed_int32 + 1; list[_n_packed_int32] = val
end
elseif id == 2 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_int64
if list == nil then list = table_new(lim, 0); result.packed_int64 = list end
while p2 <= lim do
local val
val, p2 = decode_int64(payload, p2)
_n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val
end
else
local list = result.packed_int64
if list == nil then list = {}; result.packed_int64 = list end
local val
val, pos = decode_int64(buf, pos)
_n_packed_int64 = _n_packed_int64 + 1; list[_n_packed_int64] = val
end
elseif id == 3 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_sint32
if list == nil then list = table_new(lim, 0); result.packed_sint32 = list end
while p2 <= lim do
local val
val, p2 = decode_sint32(payload, p2)
_n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val
end
else
local list = result.packed_sint32
if list == nil then list = {}; result.packed_sint32 = list end
local val
val, pos = decode_sint32(buf, pos)
_n_packed_sint32 = _n_packed_sint32 + 1; list[_n_packed_sint32] = val
end
elseif id == 4 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_uint32
if list == nil then list = table_new(lim, 0); result.packed_uint32 = list end
while p2 <= lim do
local val
val, p2 = decode_uint32(payload, p2)
_n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val
end
else
local list = result.packed_uint32
if list == nil then list = {}; result.packed_uint32 = list end
local val
val, pos = decode_uint32(buf, pos)
_n_packed_uint32 = _n_packed_uint32 + 1; list[_n_packed_uint32] = val
end
elseif id == 5 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_fixed32
if list == nil then list = table_new(rshift(lim, 2), 0); result.packed_fixed32 = list end
while p2 <= lim do
local val
val, p2 = decode_fixed32(payload, p2)
_n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val
end
else
local list = result.packed_fixed32
if list == nil then list = {}; result.packed_fixed32 = list end
local val
val, pos = decode_fixed32(buf, pos)
_n_packed_fixed32 = _n_packed_fixed32 + 1; list[_n_packed_fixed32] = val
end
elseif id == 6 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_fixed64
if list == nil then list = table_new(rshift(lim, 3), 0); result.packed_fixed64 = list end
while p2 <= lim do
local val
val, p2 = decode_fixed64(payload, p2)
_n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val
end
else
local list = result.packed_fixed64
if list == nil then list = {}; result.packed_fixed64 = list end
local val
val, pos = decode_fixed64(buf, pos)
_n_packed_fixed64 = _n_packed_fixed64 + 1; list[_n_packed_fixed64] = val
end
elseif id == 7 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_double
if list == nil then list = table_new(rshift(lim, 3), 0); result.packed_double = list end
while p2 <= lim do
local val
val, p2 = decode_double(payload, p2)
_n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val
end
else
local list = result.packed_double
if list == nil then list = {}; result.packed_double = list end
local val
val, pos = decode_double(buf, pos)
_n_packed_double = _n_packed_double + 1; list[_n_packed_double] = val
end
elseif id == 8 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_float
if list == nil then list = table_new(rshift(lim, 2), 0); result.packed_float = list end
while p2 <= lim do
local val
val, p2 = decode_float(payload, p2)
_n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val
end
else
local list = result.packed_float
if list == nil then list = {}; result.packed_float = list end
local val
val, pos = decode_float(buf, pos)
_n_packed_float = _n_packed_float + 1; list[_n_packed_float] = val
end
elseif id == 9 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.packed_bool
if list == nil then list = table_new(lim, 0); result.packed_bool = list end
while p2 <= lim do
local val
val, p2 = decode_bool(payload, p2)
_n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val
end
else
local list = result.packed_bool
if list == nil then list = {}; result.packed_bool = list end
local val
val, pos = decode_bool(buf, pos)
_n_packed_bool = _n_packed_bool + 1; list[_n_packed_bool] = val
end
elseif id == 20 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.unpacked_int32
if list == nil then list = table_new(lim, 0); result.unpacked_int32 = list end
while p2 <= lim do
local val
val, p2 = decode_int32(payload, p2)
_n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val
end
else
local list = result.unpacked_int32
if list == nil then list = {}; result.unpacked_int32 = list end
local val
val, pos = decode_int32(buf, pos)
_n_unpacked_int32 = _n_unpacked_int32 + 1; list[_n_unpacked_int32] = val
end
elseif id == 21 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.unpacked_fixed64
if list == nil then list = table_new(rshift(lim, 3), 0); result.unpacked_fixed64 = list end
while p2 <= lim do
local val
val, p2 = decode_fixed64(payload, p2)
_n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val
end
else
local list = result.unpacked_fixed64
if list == nil then list = {}; result.unpacked_fixed64 = list end
local val
val, pos = decode_fixed64(buf, pos)
_n_unpacked_fixed64 = _n_unpacked_fixed64 + 1; list[_n_unpacked_fixed64] = val
end
elseif id == 22 then
if wt == 2 then
local payload
payload, pos = decode_len(buf, pos)
local p2, lim = 1, #payload
local list = result.unpacked_sint32
if list == nil then list = table_new(lim, 0); result.unpacked_sint32 = list end
while p2 <= lim do
local val
val, p2 = decode_sint32(payload, p2)
_n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val
end
else
local list = result.unpacked_sint32
if list == nil then list = {}; result.unpacked_sint32 = list end
local val
val, pos = decode_sint32(buf, pos)
_n_unpacked_sint32 = _n_unpacked_sint32 + 1; list[_n_unpacked_sint32] = val
end
elseif id == 30 then
local list = result.strings
if list == nil then list = {}; result.strings = list end
local _lb = string_byte(buf, pos)
if _lb ~= nil and _lb < 0x80 then
local _np = pos + 1
local _epos = _np + _lb
if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
local _s = buf:sub(_np, _epos - 1)
if utf8_len(_s) == nil then error("invalid UTF-8 in string field at offset " .. pos, 0) end
_n_strings = _n_strings + 1; list[_n_strings] = _s
pos = _epos
else
local val
val, pos = wire.decode_string(buf, pos)
_n_strings = _n_strings + 1; list[_n_strings] = val
end
elseif id == 31 then
local list = result.blobs
if list == nil then list = {}; result.blobs = list end
local _lb = string_byte(buf, pos)
if _lb ~= nil and _lb < 0x80 then
local _np = pos + 1
local _epos = _np + _lb
if _epos - 1 > len then error("truncated LEN at offset " .. pos, 0) end
local _s = buf:sub(_np, _epos - 1)
_n_blobs = _n_blobs + 1; list[_n_blobs] = _s
pos = _epos
else
local val
val, pos = wire.decode_bytes(buf, pos)
_n_blobs = _n_blobs + 1; list[_n_blobs] = val
end
elseif id == 40 then
local list = result.messages
if list == nil then list = {}; result.messages = list end
local payload
payload, pos = decode_len(buf, pos)
_n_messages = _n_messages + 1; list[_n_messages] = M.Inner_decode(payload)
else
local _ebid = M.Holder_descriptor.extensions_by_id
local _ext = _ebid and _ebid[id] or nil
if _ext ~= nil then
pos = pb.codec.decode_extension(_ext, buf, pos, wt, result)
else
pos = wire.skip_field(buf, pos, wt, id)
if _uf == nil then _uf = {} end
_uf[#_uf + 1] = buf:sub(_tag_start, pos - 1)
end
end
end
if _uf ~= nil then result._unknown_fields = table.concat(_uf) end
return result
end
---@param b string
---@return pb.MessageView
function M.Holder_decode_lazy(b) return pb.decode_lazy(M.Holder_descriptor, b) end
---@param t c_repeated.Holder
---@param opts? {single_line: boolean?, indent: string?}
---@return string
function M.Holder_text(t, opts) return pb.text.encode(M.Holder_descriptor, t, opts) end
return M