Function readLengthDelimited

Read a length-delimited field payload as a borrowed slice.

bool readLengthDelimited(
  ref WireCursor cursor,
  uint fieldNumber,
  out const(ubyte)[] bytes,
  out WireStatus status
) nothrow @nogc @safe;

The cursor must point at the length varint, directly after the field key. Returned bytes borrow the cursor's original input buffer and are never copied.

Parameters

NameDescription
cursor Cursor positioned at the field's encoded length.
fieldNumber Field number used for error reporting.
bytes Receives the borrowed payload slice on success.
status Receives success or a length/payload decoding failure.

Returns

true when the complete payload is present and its length fits size_t; false otherwise.