Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/modules/ROOT/pages/4.servers/4b.route-handlers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ object.

[source,cpp]
----
capy::io_task<> send(std::string_view body = {});
capy::task<capy::results<>> send(std::string_view body = {});
----

This is where the real magic happens. `send()` is an asynchronous
Expand Down Expand Up @@ -581,7 +581,7 @@ route_task my_handler(route_params& rp)
}
----

The return type is `io_task<>`, which yields a single `error_code`
The return type is `task<results<>>`, which yields a single `error_code`
through structured bindings. If the send succeeds, `ec` is
non-failing. If the client disconnected or a write error occurred,
`ec` describes the failure and you can propagate it with
Expand Down
6 changes: 3 additions & 3 deletions include/boost/http/bcrypt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <boost/capy/continuation.hpp>
#include <boost/capy/task.hpp>
#include <boost/capy/ex/executor_ref.hpp>
#include <boost/capy/ex/io_env.hpp>
#include <boost/capy/ex/await_context.hpp>
#include <boost/capy/ex/run_async.hpp>
#include <boost/capy/ex/system_context.hpp>

Expand Down Expand Up @@ -516,7 +516,7 @@ struct hash_async_op

void await_suspend(
std::coroutine_handle<void> cont,
capy::io_env const* env)
capy::await_context const* env)
{
cont_.h = cont;
auto caller_ex = env->executor;
Expand Down Expand Up @@ -561,7 +561,7 @@ struct compare_async_op

void await_suspend(
std::coroutine_handle<void> cont,
capy::io_env const* env)
capy::await_context const* env)
{
cont_.h = cont;
auto caller_ex = env->executor;
Expand Down
18 changes: 9 additions & 9 deletions include/boost/http/concept/buffer_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <boost/capy/detail/config.hpp>
#include <boost/capy/buffers.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/io_awaitable.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
#include <system_error>

#include <concepts>
Expand Down Expand Up @@ -41,9 +41,9 @@ namespace http {

@li `T` must provide a synchronous `prepare` member function accepting
a `std::span<capy::mutable_buffer>` and returning a span of filled buffers
@li `T` must provide `commit(n)` returning an @ref capy::IoAwaitable that
@li `T` must provide `commit(n)` returning an @ref capy::ContextAwaitable that
decomposes to `(error_code)`
@li `T` must provide `commit_eof(n)` returning an @ref capy::IoAwaitable
@li `T` must provide `commit_eof(n)` returning an @ref capy::ContextAwaitable
that decomposes to `(error_code)`

@par Semantic Requirements
Expand Down Expand Up @@ -80,15 +80,15 @@ namespace http {
@code
std::span<capy::mutable_buffer> prepare( std::span<capy::mutable_buffer> dest );

capy::IoAwaitable auto commit( std::size_t n );
capy::IoAwaitable auto commit_eof( std::size_t n );
capy::ContextAwaitable auto commit( std::size_t n );
capy::ContextAwaitable auto commit_eof( std::size_t n );
@endcode

@par Example

@code
template<BufferSource Source, BufferSink Sink>
io_task<std::size_t> transfer( Source& source, Sink& sink )
task<results<std::size_t>> transfer( Source& source, Sink& sink )
{
capy::const_buffer src_arr[16];
capy::mutable_buffer dst_arr[16];
Expand Down Expand Up @@ -117,7 +117,7 @@ namespace http {
}
@endcode

@see BufferSource, WriteSink, capy::IoAwaitable, capy::awaitable_decomposes_to
@see BufferSource, WriteSink, capy::ContextAwaitable, capy::awaitable_decomposes_to
*/
template<typename T>
concept BufferSink =
Expand All @@ -127,13 +127,13 @@ concept BufferSink =
{ sink.prepare(dest) } -> std::same_as<std::span<capy::mutable_buffer>>;

// Async: commit n bytes written
{ sink.commit(n) } -> capy::IoAwaitable;
{ sink.commit(n) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(sink.commit(n)),
std::error_code>;

// Async: commit n final bytes and signal end of data
{ sink.commit_eof(n) } -> capy::IoAwaitable;
{ sink.commit_eof(n) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(sink.commit_eof(n)),
std::error_code>;
Expand Down
12 changes: 6 additions & 6 deletions include/boost/http/concept/buffer_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <boost/capy/buffers.hpp>
#include <boost/capy/cond.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/io_awaitable.hpp>
#include <boost/capy/concept/context_awaitable.hpp>

#include <cstddef>
#include <span>
Expand All @@ -40,7 +40,7 @@ namespace http {

@li `T` must provide a `pull` member function accepting a
`std::span<capy::const_buffer>` for output
@li The return type must satisfy @ref capy::IoAwaitable
@li The return type must satisfy @ref capy::ContextAwaitable
@li The awaitable must decompose to `(error_code,std::span<capy::const_buffer>)`
via structured bindings
@li `T` must provide a `consume` member function accepting a byte count
Expand Down Expand Up @@ -72,7 +72,7 @@ namespace http {
@par Conforming Signatures

@code
some_io_awaitable<io_result<std::span<capy::const_buffer>>>
some_context_awaitable<results<std::span<capy::const_buffer>>>
pull( std::span<capy::const_buffer> dest );

void consume( std::size_t n ) noexcept;
Expand All @@ -82,7 +82,7 @@ namespace http {

@code
template<BufferSource Source, capy::WriteStream Stream>
io_task<std::size_t> transfer( Source& source, Stream& stream )
task<results<std::size_t>> transfer( Source& source, Stream& stream )
{
capy::const_buffer arr[16];
std::size_t total = 0;
Expand All @@ -102,13 +102,13 @@ namespace http {
}
@endcode

@see capy::IoAwaitable, WriteSink, capy::awaitable_decomposes_to
@see capy::ContextAwaitable, WriteSink, capy::awaitable_decomposes_to
*/
template<typename T>
concept BufferSource =
requires(T& src, std::span<capy::const_buffer> dest, std::size_t n)
{
{ src.pull(dest) } -> capy::IoAwaitable;
{ src.pull(dest) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(src.pull(dest)),
std::error_code, std::span<capy::const_buffer>>;
Expand Down
12 changes: 6 additions & 6 deletions include/boost/http/concept/read_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <boost/capy/detail/config.hpp>
#include <boost/capy/concept/buffer_archetype.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/io_awaitable.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
#include <boost/capy/concept/read_stream.hpp>
#include <system_error>

Expand Down Expand Up @@ -41,7 +41,7 @@ namespace http {
@li `T` must satisfy @ref capy::ReadStream (provides `read_some`)
@li `T` must provide a `read` member function template accepting
any @ref MutableBufferSequence
@li The return type of `read` must satisfy @ref capy::IoAwaitable
@li The return type of `read` must satisfy @ref capy::ContextAwaitable
@li The awaitable must decompose to `(error_code, std::size_t)`
via structured bindings

Expand Down Expand Up @@ -87,10 +87,10 @@ namespace http {

@code
template< MutableBufferSequence MB >
capy::IoAwaitable auto read_some( MB buffers ); // inherited from capy::ReadStream
capy::ContextAwaitable auto read_some( MB buffers ); // inherited from capy::ReadStream

template< MutableBufferSequence MB >
capy::IoAwaitable auto read( MB buffers );
capy::ContextAwaitable auto read( MB buffers );
@endcode

@warning **Coroutine Buffer Lifetime**: When implementing coroutine
Expand All @@ -116,15 +116,15 @@ namespace http {
}
@endcode

@see capy::ReadStream, capy::IoAwaitable, MutableBufferSequence,
@see capy::ReadStream, capy::ContextAwaitable, MutableBufferSequence,
capy::awaitable_decomposes_to
*/
template<typename T>
concept ReadSource =
capy::ReadStream<T> &&
requires(T& source, capy::mutable_buffer_archetype buffers)
{
{ source.read(buffers) } -> capy::IoAwaitable;
{ source.read(buffers) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(source.read(buffers)),
std::error_code, std::size_t>;
Expand Down
20 changes: 10 additions & 10 deletions include/boost/http/concept/write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <boost/capy/detail/config.hpp>
#include <boost/capy/concept/buffer_archetype.hpp>
#include <boost/capy/concept/decomposes_to.hpp>
#include <boost/capy/concept/io_awaitable.hpp>
#include <boost/capy/concept/context_awaitable.hpp>
#include <boost/capy/concept/write_stream.hpp>
#include <system_error>

Expand Down Expand Up @@ -48,7 +48,7 @@ namespace http {
@li `T` must provide a `write_eof` member function taking no
arguments, returning an awaitable that decomposes to
`(error_code)`
@li All return types must satisfy @ref capy::IoAwaitable
@li All return types must satisfy @ref capy::ContextAwaitable

@par Semantic Requirements

Expand Down Expand Up @@ -95,15 +95,15 @@ namespace http {

@code
template< ConstBufferSequence Buffers >
capy::IoAwaitable auto write_some( Buffers buffers ); // inherited
capy::ContextAwaitable auto write_some( Buffers buffers ); // inherited

template< ConstBufferSequence Buffers >
capy::IoAwaitable auto write( Buffers buffers );
capy::ContextAwaitable auto write( Buffers buffers );

template< ConstBufferSequence Buffers >
capy::IoAwaitable auto write_eof( Buffers buffers );
capy::ContextAwaitable auto write_eof( Buffers buffers );

capy::IoAwaitable auto write_eof();
capy::ContextAwaitable auto write_eof();
@endcode

@warning **Coroutine Buffer Lifetime**: When implementing coroutine
Expand Down Expand Up @@ -137,23 +137,23 @@ namespace http {
}
@endcode

@see capy::WriteStream, capy::IoAwaitable, ConstBufferSequence,
@see capy::WriteStream, capy::ContextAwaitable, ConstBufferSequence,
capy::awaitable_decomposes_to
*/
template<typename T>
concept WriteSink =
capy::WriteStream<T> &&
requires(T& sink, capy::const_buffer_archetype buffers)
{
{ sink.write(buffers) } -> capy::IoAwaitable;
{ sink.write(buffers) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(sink.write(buffers)),
std::error_code, std::size_t>;
{ sink.write_eof(buffers) } -> capy::IoAwaitable;
{ sink.write_eof(buffers) } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(sink.write_eof(buffers)),
std::error_code, std::size_t>;
{ sink.write_eof() } -> capy::IoAwaitable;
{ sink.write_eof() } -> capy::ContextAwaitable;
requires capy::awaitable_decomposes_to<
decltype(sink.write_eof()),
std::error_code>;
Expand Down
Loading
Loading