Function readVarint32

Decode one protobuf 32-bit varint value.

bool readVarint32(
  scope ref WireCursor cursor,
  out uint value,
  out WireStatus status
) nothrow @nogc @safe;

Protobuf scalar parsing consumes a complete legal 64-bit varint and keeps the low 32 bits for 32-bit integer field types. This deliberately differs from length/size decoding, where truncation would be unsafe.

Parameters

NameDescription
cursor Cursor positioned at the first byte of the varint.
value Receives the low 32 bits of the decoded wire value.
status Receives success or a wire-decoding failure.

Returns

true for every legal protobuf varint; false only when the underlying 64-bit varint is malformed or truncated.