nxtio/buffers.hpp file

Namespaces

namespace nxt
namespace nxt::io
namespace nxt::io::detail

Classes

struct nxt::io::buffer_error
Base exception for buffered byte I/O helpers.
struct nxt::io::end_of_stream
Raised when a reader needs more bytes but the source ended.
struct nxt::io::operation_cancelled
Raised when a stop token cancels a buffered operation.
class nxt::io::string_source
Borrowed in-memory source exposed through read_some.
class nxt::io::string_sink
In-memory sink that appends all writes to a string.
class nxt::io::string_transport
In-memory transport for tests, fixtures, and replay harnesses.
class nxt::io::byte_cursor
Synchronous cursor over an already-buffered byte span.
template <typename Source>
class nxt::io::byte_reader
Buffered asynchronous reader over any source with a read_some method.
template <typename Sink>
class nxt::io::byte_writer
Buffered asynchronous writer over any sink with a write_all method.

Functions

auto as_bytes(std::string_view text) →  std::span<const std::byte> noexcept
Reinterpret a string view as immutable bytes.
auto as_chars(std::span<const std::byte> bytes) →  std::span<const char> noexcept
Reinterpret immutable bytes as chars.
auto as_string_view(std::span<const std::byte> bytes) →  std::string_view noexcept
View a byte span as immutable character data.
auto as_writable_chars(std::span<std::byte> bytes) →  std::span<char> noexcept
Reinterpret writable bytes as writable chars.
void check_cancelled(std::stop_token stop)
auto find_bytes(std::span<const std::byte> haystack, std::span<const std::byte> needle) →  std::size_t
template <typename Source>
auto read_some_bytes(Source& source, std::span<std::byte> dst) →  nxt::task<std::size_t>
template <typename Source>
auto read_some_bytes(Source& source, std::span<std::byte> dst, std::stop_token stop) →  nxt::task<std::size_t>
template <typename Sink>
auto write_all_bytes(Sink& sink, std::span<const std::byte> bytes) →  nxt::task