File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
include/boost/redis/adapter Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,19 @@ class connection_base;
26
26
27
27
}
28
28
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
+ */
29
42
class any_adapter
30
43
{
31
44
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
48
61
friend class detail ::connection_base;
49
62
50
63
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
+ */
51
74
template <class T , class = std::enable_if_t <!std::is_same_v<T, any_adapter>>>
52
75
explicit any_adapter (T& response) : impl_(create_impl(response)) {}
53
76
};
You can’t perform that action at this time.
0 commit comments