proxygen
request_via.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
22 
23 namespace folly {
24 namespace pushmi {
25 
26 template <typename In>
27 struct send_via {
28  In in;
29  PUSHMI_TEMPLATE(class... AN)
30  (requires Invocable<decltype(::folly::pushmi::operators::via), AN...>&&
31  Invocable<
33  In>)
34  auto via(AN&&... an) {
35  return in | ::folly::pushmi::operators::via((AN &&) an...);
36  }
37 };
38 
39 namespace detail {
40 
42  private:
43  struct impl {
44  PUSHMI_TEMPLATE(class In)
45  (requires Sender<In>)
46  auto operator()(In in) const {
47  return send_via<In>{in};
48  }
49  };
50 
51  public:
52  inline auto operator()() const {
53  return impl{};
54  }
55 };
56 
57 } // namespace detail
58 
59 namespace operators {
60 
62 
63 } // namespace operators
64 
65 PUSHMI_TEMPLATE(class To, class In)
66 (requires Same<To, is_sender<>>&& Sender<In>)
67 auto via_cast(In in) {
68  return in;
69 }
70 
71 PUSHMI_TEMPLATE(class To, class In)
72 (requires Same<To, is_sender<>>)
74  return ss.in;
75 }
76 
77 } // namespace pushmi
78 } // namespace folly
PUSHMI_INLINE_VAR constexpr detail::request_via_fn request_via
Definition: request_via.h:61
requires Same< To, is_sender<> > &&Sender< In > auto via_cast(In in)
Definition: request_via.h:67
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
PUSHMI_INLINE_VAR constexpr detail::via_fn via
Definition: via.h:166
requires Invocable< decltype(::folly::pushmi::operators::via), AN... > &&Invocable< invoke_result_t< decltype(::folly::pushmi::operators::via), AN... >, In > auto via(AN &&...an)
Definition: request_via.h:34
#define PUSHMI_INLINE_VAR
Definition: concept_def.h:60
requires requires(detail::apply_impl(std::declval< F >(), std::declval< Tuple >(), detail::tupidxs< Tuple >{}))) const expr decltype(auto) apply(F &&f
PUSHMI_TEMPLATE(class E=std::exception_ptr, class Wrapped)(requires Sender< detail
Definition: executor.h:102
decltype(folly::pushmi::invoke(std::declval< F >(), std::declval< As >()...)) invoke_result_t
Definition: functional.h:47