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
| Name | Description |
|---|---|
this
(input)
|
Construct a cursor over input.
|
Properties
| Name | Type | Description |
|---|---|---|
empty[get]
|
bool | Returns true when no unread bytes remain.
|
offset[get]
|
ulong | Returns the number of bytes consumed from the original input. |
remaining[get]
|
ulong | Returns the number of unread bytes. |
Methods
| Name | Description |
|---|---|
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.