2
0
mirror of https://github.com/boostorg/redis.git synced 2026-01-19 04:42:09 +00:00

get_impl is now private

This commit is contained in:
Ruben Perez
2024-08-07 09:34:17 +02:00
parent 6c6bcd03c0
commit 6e7c42be7f
2 changed files with 14 additions and 6 deletions

View File

@@ -10,7 +10,7 @@
#include <boost/redis/resp3/node.hpp>
#include <boost/redis/adapter/adapt.hpp>
#include <boost/system/detail/error_code.hpp>
#include <boost/system/error_code.hpp>
#include <cstddef>
#include <functional>
#include <string_view>
@@ -18,6 +18,14 @@
namespace boost::redis {
namespace detail {
// Forward decl
template <class Executor>
class connection_base;
}
class any_adapter
{
using fn_type = std::function<void(std::size_t, resp3::basic_node<std::string_view> const&, system::error_code&)>;
@@ -36,12 +44,12 @@ class any_adapter
return { std::move(adapter), size };
}
template <class Executor>
friend class detail::connection_base;
public:
template <class T, class = std::enable_if_t<!std::is_same_v<T, any_adapter>>>
explicit any_adapter(T& response) : impl_(create_impl(response)) {}
// TODO: make this private
auto get_impl() && { return std::move(impl_); }
};
}

View File

@@ -445,9 +445,9 @@ public:
}
template <class CompletionToken>
auto async_exec(request const& req, any_adapter adapter, CompletionToken&& token)
auto async_exec(request const& req, any_adapter&& adapter, CompletionToken&& token)
{
auto adapter_impl = std::move(adapter).get_impl();
auto& adapter_impl = adapter.impl_;
BOOST_ASSERT_MSG(req.get_expected_responses() <= adapter_impl.supported_response_size, "Request and response have incompatible sizes.");
auto info = std::make_shared<req_info>(req, std::move(adapter_impl.adapt_fn), get_executor());