26 return std::unexpected(
Error::Invalid(
"a varint runs past the end of the payload"));
30 value |=
static_cast<uint64_t>(
part & 0x7Fu) << (7 *
byte);
31 if ((
part & 0x80u) == 0)
36 return std::unexpected(
Error::Invalid(
"a varint is longer than ten bytes"));
59 return std::unexpected(
length.error());
65 return std::unexpected(
Error::Invalid(
"a field runs past the end of the payload"));
68 at +=
static_cast<size_t>(*length);
78 return std::unexpected(
Error::Invalid(
"a field runs past the end of the payload"));
94 return std::unexpected(
key.error());
105 return std::unexpected(
length.error());
109 return std::unexpected(
Error::Invalid(
"the button id runs past the end of the payload"));
113 at +=
static_cast<size_t>(*length);
120 return std::unexpected(
skipped.error());
126 return std::unexpected(
Error::Invalid(
"the payload carries no button id"));
static constexpr uint32_t WireLengthDelimited
static constexpr uint32_t WireFixed32
static constexpr uint32_t WireVarint
static Result< uint64_t > ReadVarint(std::string_view bytes, size_t &at)
static std::string ReadFile(const std::filesystem::path &path)
static constexpr uint32_t WireFixed64
static constexpr int MaxVarintBytes
static Status SkipField(std::string_view bytes, size_t &at, uint32_t wireType)
std::expected< void, Error > Status
std::expected< T, Error > Result
static Error Invalid(std::string detail)