#include <async_stream.hpp>
◆ Options
◆ AsyncStream() [1/2]
| pulp::runtime::AsyncStream::AsyncStream |
( |
std::unique_ptr< Stream > | stream, |
|
|
Options | options = {} ) |
|
explicit |
◆ ~AsyncStream()
| pulp::runtime::AsyncStream::~AsyncStream |
( |
| ) |
|
◆ AsyncStream() [2/2]
| pulp::runtime::AsyncStream::AsyncStream |
( |
const AsyncStream & | | ) |
|
|
delete |
◆ cancel()
| void pulp::runtime::AsyncStream::cancel |
( |
| ) |
|
Request cancellation.
Pending writes complete with StreamError::Closed; the worker exits at its next scheduled point.
◆ cancellation_token()
| CancelToken pulp::runtime::AsyncStream::cancellation_token |
( |
| ) |
const |
|
inline |
Cancellation token shared with this stream's worker.
Callers can pass this to user code that wants to observe cancellation alongside the stream lifetime.
◆ on_close()
◆ on_data()
Attach callbacks.
Must be called before start() so the worker has somewhere to send events. Safe to overwrite between stop() and start(); not safe to reassign while the worker is running.
◆ on_drain()
fires when pending writes hit 0
◆ on_error()
◆ operator=()
◆ pending_write_bytes()
| std::size_t pulp::runtime::AsyncStream::pending_write_bytes |
( |
| ) |
const |
Bytes currently queued for writing.
◆ start()
| void pulp::runtime::AsyncStream::start |
( |
| ) |
|
Start the worker thread. No-op if already running.
◆ stop()
| void pulp::runtime::AsyncStream::stop |
( |
| ) |
|
Stop the worker thread and wait for it to exit.
Fires on_close exactly once if it has not fired already.
◆ stream()
| Stream * pulp::runtime::AsyncStream::stream |
( |
| ) |
|
|
inline |
Underlying Stream, for advanced callers.
Not thread-safe with the worker; only touch from the worker thread or after stop().
◆ write_async()
| bool pulp::runtime::AsyncStream::write_async |
( |
const std::uint8_t * | data, |
|
|
std::size_t | size, |
|
|
AsyncWriteCallback | callback = {} ) |
|
nodiscard |
Queue an async write.
Returns false if the write would exceed the configured high-water mark (backpressure). The caller should wait for on_drain before trying again.
The documentation for this class was generated from the following file: