proxygen
on.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 
21 
22 namespace folly {
23 namespace pushmi {
24 
25 namespace detail {
26 
27 struct on_fn {
28  private:
29  template <class In, class Out>
30  struct on_value_impl {
31  In in_;
32  Out out_;
33  void operator()(any) {
34  submit(in_, std::move(out_));
35  }
36  };
37  template <class In, class ExecutorFactory>
38  struct out_impl {
39  ExecutorFactory ef_;
40  PUSHMI_TEMPLATE(class Out)
41  (requires SenderTo<In, Out>)
42  void operator()(In& in, Out out) const {
43  auto exec = ef_();
44  submit(
45  exec,
48  }
49  };
50  template <class In, class TP, class Out>
52  In in_;
53  TP at_;
54  Out out_;
55  void operator()(any) {
56  submit(in_, at_, std::move(out_));
57  }
58  };
59  template <class In, class ExecutorFactory>
60  struct time_out_impl {
61  ExecutorFactory ef_;
62  PUSHMI_TEMPLATE(class TP, class Out)
63  (requires TimeSenderTo<In, Out>)
64  void operator()(In& in, TP at, Out out) const {
65  auto exec = ef_();
66  submit(
67  exec,
68  at,
71  }
72  };
73  template <class ExecutorFactory>
74  struct in_impl {
75  ExecutorFactory ef_;
76  PUSHMI_TEMPLATE(class In)
77  (requires Sender<In>)
78  auto operator()(In in) const {
80  std::move(in),
81  detail::submit_transform_out<In>(
84  }
85  };
86 
87  public:
88  PUSHMI_TEMPLATE(class ExecutorFactory)
89  (requires Invocable<ExecutorFactory&>&&
91  auto operator()(ExecutorFactory ef) const {
93  }
94 };
95 
96 } // namespace detail
97 
98 namespace operators {
99 
101 
102 } // namespace operators
103 
104 } // namespace pushmi
105 } // namespace folly
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
requires requires(::folly::pushmi::invoke(std::declval< F >(), std::get< Is >(std::declval< Tuple >())...))) const expr decltype(auto) apply_impl(F &&f
#define PUSHMI_INLINE_VAR
Definition: concept_def.h:60
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::detail::sender_from_fn sender_from
PUSHMI_INLINE_VAR constexpr __adl::do_submit_fn submit
PUSHMI_TEMPLATE(class In, class Out, bool SenderRequires, bool SingleSenderRequires, bool TimeSingleSenderRequires)(requires Sender< In > &&Receiver< Out >) constexpr bool sender_requires_from()
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::make_receiver_fn make_receiver
PUSHMI_INLINE_VAR constexpr detail::on_fn on
Definition: on.h:100