boost::capy::any_read_source::read
Initiate a complete read operation.
Synopsis
template<MutableBufferSequence MB>
io_task<std::size_t>
read(MB buffers);
Description
Reads data into the provided buffer sequence by forwarding to the underlying source's read operation. Large buffer sequences are processed in windows, with each window forwarded as a separate read call to the underlying source. The operation completes when the entire buffer sequence is filled, end‐of‐file is reached, or an error occurs.
Immediate Completion
The operation completes immediately without suspending the calling coroutine when:
-
The buffer sequence is empty, returning `{error_code{}, 0}`.
-
The underlying source's `read` awaitable reports immediate readiness via `await_ready`.
Postconditions
Exactly one of the following is true on return:
-
**Success**: `!ec` and `n == buffer_size(buffers)`. The entire buffer was filled.
-
**End‐of‐stream or Error**: `ec` and `n` indicates the number of bytes transferred before the failure.
Preconditions
The wrapper must contain a valid source (has_value() == true). The caller must not call this function again after a prior call returned an error (including EOF).
Parameters
| Name | Description |
|---|---|
buffers |
The buffer sequence to read into. |
Created with MrDocs