Skip to content

Commit 299e7ca

Browse files
committed
Reference docs (2)
1 parent 0f56460 commit 299e7ca

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

include/boost/redis/adapter/any_adapter.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ class connection_base;
2626

2727
}
2828

29+
/** @brief A type-erased reference to a response.
30+
* @ingroup high-level-api
31+
*
32+
* A type-erased response adapter. It can be executed using @ref connection::async_exec.
33+
* Using this type instead of raw response references enables separate compilation.
34+
*
35+
* Given a response object `resp` that can be passed to `async_exec`, the following two
36+
* statements have the same effect:
37+
* ```
38+
* co_await conn.async_exec(req, resp);
39+
* co_await conn.async_exec(req, any_response(resp));
40+
* ```
41+
*/
2942
class any_adapter
3043
{
3144
using fn_type = std::function<void(std::size_t, resp3::basic_node<std::string_view> const&, system::error_code&)>;
@@ -48,6 +61,16 @@ class any_adapter
4861
friend class detail::connection_base;
4962

5063
public:
64+
/**
65+
* @brief Constructor.
66+
*
67+
* Creates a type-erased response adapter from `response` by calling
68+
* @ref boost_redis_adapt. `T` must be a valid Redis response type.
69+
* Any type passed to @ref connection::async_exec qualifies.
70+
*
71+
* This object stores a reference to `response`, which must be kept alive
72+
* while `*this` is being used.
73+
*/
5174
template <class T, class = std::enable_if_t<!std::is_same_v<T, any_adapter>>>
5275
explicit any_adapter(T& response) : impl_(create_impl(response)) {}
5376
};

0 commit comments

Comments
 (0)