Struct WireCursor

Mutable read cursor over one borrowed const-qualified wire buffer.

struct WireCursor;

The cursor never allocates and never owns the underlying bytes. Slices returned by take refer to the same caller-owned storage.

Constructors

NameDescription
this (input) Construct a cursor over input.

Properties

NameTypeDescription
empty[get] boolReturns true when no unread bytes remain.
offset[get] ulongReturns the number of bytes consumed from the original input.
remaining[get] ulongReturns the number of unread bytes.

Methods

NameDescription
readByte (value) Read one byte and advance the cursor.
skip (count) Advance the cursor by count bytes without reading them.
take (count, bytes) Borrow the next count bytes and advance the cursor.
takeCursor (count, ok) Borrow the next count bytes as a child cursor and advance this cursor.

Notes

The caller must keep the original storage alive while the cursor or a slice returned by take is used. The cursor itself contains a D slice, so ordinary bounds and memory-safety rules remain available to @safe code.