Go to the documentation of this file.
15 #ifndef GRPC_CORE_LIB_PROMISE_FOR_EACH_H
16 #define GRPC_CORE_LIB_PROMISE_FOR_EACH_H
20 #include <type_traits>
23 #include "absl/status/status.h"
24 #include "absl/types/variant.h"
31 namespace for_each_detail {
36 template <
typename Reader,
typename CallPoll>
41 return call_poll(
next);
57 template <
typename Reader,
typename Action>
96 template <
bool kSetState>
101 auto r = reader_next();
102 if (
auto* p = absl::get_if<kPollReadyIdx>(&
r)) {
103 if (p->has_value()) {
111 self->state_.template emplace<ReaderNext>(
std::move(reader_next));
118 if (
auto* p = absl::get_if<kPollReadyIdx>(&
r)) {
122 self->state_.template emplace<ActionPromise>(
std::move(promise));
132 template <
typename Reader,
typename Action>
140 #endif // GRPC_CORE_LIB_PROMISE_FOR_EACH_H
typename ActionFactory::Promise ActionPromise
typename PollTraits< decltype(std::declval< ActionPromise >()())>::Type Result
ForEach & operator=(const ForEach &)=delete
for_each_detail::ForEach< Reader, Action > ForEach(Reader reader, Action action)
For each item acquired by calling Reader::Next, run the promise Action.
absl::variant< ReaderNext, ActionPromise > state_
Poll< Result > operator()(ActionPromise &promise)
static AllocList * Next(int i, AllocList *prev, LowLevelAlloc::Arena *arena)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
ForEach(Reader reader, Action action)
ActionFactory action_factory_
Poll< Result > operator()()
typename PollTraits< decltype(std::declval< ReaderNext >()())>::Type::value_type ReaderResult
Poll< Result > operator()(ReaderNext &reader_next)
AllocList * next[kMaxLevel]
GRPC_CUSTOM_UTIL_STATUS Status
static absl::Status Make()
decltype(PromiseFactoryImpl(std::move(f_), std::declval< ReaderResult >())) Promise
variant_internal::VisitResult< Visitor, Variants... > visit(Visitor &&vis, Variants &&... vars)
Poll< absl::Status > FinishIteration(absl::Status *r, Reader *reader, CallPoll call_poll)
decltype(std::declval< Reader >().Next()) ReaderNext
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:22