join.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_LIB_PROMISE_JOIN_H
16 #define GRPC_CORE_LIB_PROMISE_JOIN_H
17 
19 
20 #include "absl/meta/type_traits.h"
21 
23 
24 namespace grpc_core {
25 namespace promise_detail {
26 
27 struct JoinTraits {
28  template <typename T>
30  template <typename T, typename F>
31  static auto OnResult(T result, F kontinue)
32  -> decltype(kontinue(std::move(result))) {
33  return kontinue(std::move(result));
34  }
35  template <typename T>
36  static T Wrap(T x) {
37  return x;
38  }
39 };
40 
41 template <typename... Promises>
42 using Join = BasicJoin<JoinTraits, Promises...>;
43 
44 } // namespace promise_detail
45 
48 template <typename... Promise>
50  return promise_detail::Join<Promise...>(std::move(promises)...);
51 }
52 
53 } // namespace grpc_core
54 
55 #endif // GRPC_CORE_LIB_PROMISE_JOIN_H
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
grpc_core
Definition: call_metric_recorder.h:31
T
#define T(upbtypeconst, upbtype, ctype, default_value)
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
grpc_core::promise_detail::JoinTraits::Wrap
static T Wrap(T x)
Definition: join.h:36
grpc_core::promise_detail::JoinTraits
Definition: join.h:27
grpc_core::Promise
std::function< Poll< T >()> Promise
Definition: promise/promise.h:37
basic_join.h
grpc_core::promise_detail::JoinTraits::OnResult
static auto OnResult(T result, F kontinue) -> decltype(kontinue(std::move(result)))
Definition: join.h:31
grpc_core::promise_detail::JoinTraits::ResultType
absl::remove_reference_t< T > ResultType
Definition: join.h:29
absl::remove_reference_t
typename std::remove_reference< T >::type remove_reference_t
Definition: abseil-cpp/absl/meta/type_traits.h:597
grpc_core::Join
promise_detail::Join< Promise... > Join(Promise... promises)
Definition: join.h:49
port_platform.h
grpc_core::promise_detail::BasicJoin
Definition: basic_join.h:136


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:24