nxt::io::byte_cursor class

Synchronous cursor over an already-buffered byte span.

Constructors, destructors, conversion operators

byte_cursor(std::span<const std::byte> bytes) explicit
Create a cursor over bytes.
byte_cursor(std::string_view text) explicit
Create a cursor over text bytes.

Public functions

auto remaining() const →  std::span<const std::byte> noexcept
Remaining unread bytes.
auto take(std::size_t n) →  std::span<const std::byte>
Consume and return exactly n bytes.
auto take_until(std::span<const std::byte> delimiter) →  std::span<const std::byte>
Consume through delimiter and return bytes before it.
auto take_until(std::string_view delimiter) →  std::span<const std::byte>
Consume through a string delimiter and return bytes before it.
void toss(std::size_t n)
Discard n bytes.