asio-grpc v3.3.0
Asynchronous gRPC with Asio/unified executors
Loading...
Searching...
No Matches
agrpc::UseSender Struct Reference

Sender completion token. More...

#include <agrpc/use_sender.hpp>

Public Types

template<class T >
using as_default_on_t
 Type alias to adapt an I/O object to use agrpc::UseSender as its default completion token type.
 

Detailed Description

Sender completion token.

This completion token causes functions in this library to return a sender. Particularly useful for libunifex where senders are also awaitable:

unifex::task<void> server_streaming_example(agrpc::GrpcContext& grpc_context, example::v1::Example::Stub& stub)
{
grpc::ClientContext client_context;
RPC::Request request;
RPC rpc{grpc_context};
co_await rpc.start(stub, request, agrpc::use_sender);
RPC::Response response;
co_await rpc.read(response, agrpc::use_sender);
co_await rpc.finish(agrpc::use_sender);
}

Note when using libunifex or stdexec exclusively then agrpc::use_sender is already the default completion token.

Member Typedef Documentation

◆ as_default_on_t

template<class T >
using agrpc::UseSender::as_default_on_t
Initial value:
typename T::template rebind_executor<detail::ExecutorWithDefault<UseSender, typename T::executor_type>>::other

Type alias to adapt an I/O object to use agrpc::UseSender as its default completion token type.

Only applicable to I/O objects of this library.