|
| coro_rpc_client () |
|
| coro_rpc_client (asio::io_context &io_context) |
|
bool | has_closed () |
|
async_simple::coro::Lazy< coro_rpc::err_code > | connect (const std::string &host, const std::string &port, std::chrono::steady_clock::duration timeout_duration=std::chrono::seconds(5)) |
|
template<auto func, typename... Args> |
async_simple::coro::Lazy< rpc_result< util::function_return_type_t< decltype(func)> > > | call (Args &&...args) |
|
template<auto func, typename... Args> |
async_simple::coro::Lazy< rpc_result< util::function_return_type_t< decltype(func)> > > | call_for (const auto &duration, Args &&...args) |
|
auto & | get_executor () |
|
使用示例
{c++}
#include <ylt/coro_rpc/coro_rpc_client.hpp>
using namespace ylt::coro_rpc;
using namespace async_simple::coro;
auto ec = co_await client.connect("127.0.0.1", "8801");
assert(!ec);
auto result = co_await client.call<hello_coro_rpc>();
if (!result) {
std::cout << "err: " << result.error().msg << std::endl;
}
assert(result.value() == "hello coro_rpc"s);
}
int main() {
syncAwait(show_rpc_call(client));
}