xref: /openbmc/sdbusplus/include/sdbusplus/async/stdexec/__detail/__completion_signatures.hpp (revision 10d0b4b7d1498cfd5c3d37edea271a54d1984e41)
1 /*
2  * Copyright (c) 2021-2024 NVIDIA Corporation
3  *
4  * Licensed under the Apache License Version 2.0 with LLVM Exceptions
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *   https://llvm.org/LICENSE.txt
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 
18 #include "__execution_fwd.hpp"
19 
20 // include these after __execution_fwd.hpp
21 #include "__concepts.hpp"
22 #include "__diagnostics.hpp"
23 #include "__meta.hpp"
24 
25 namespace stdexec {
26   /////////////////////////////////////////////////////////////////////////////
27   // completion_signatures
28   namespace __sigs {
29     template <class... _Args>
30     inline constexpr bool __is_compl_sig<set_value_t(_Args...)> = true;
31     template <class _Error>
32     inline constexpr bool __is_compl_sig<set_error_t(_Error)> = true;
33     template <>
34     inline constexpr bool __is_compl_sig<set_stopped_t()> = true;
35 
36     template <class>
37     inline constexpr bool __is_completion_signatures = false;
38     template <class... _Sigs>
39     inline constexpr bool __is_completion_signatures<completion_signatures<_Sigs...>> = true;
40   } // namespace __sigs
41 
42   template <class... _Sigs>
43   struct completion_signatures { };
44 
45   template <class _Completions>
46   concept __valid_completion_signatures = __same_as<__ok_t<_Completions>, __msuccess>
47                                        && __sigs::__is_completion_signatures<_Completions>;
48 
49   template <class _Sender, class... _Env>
50   using __unrecognized_sender_error =
51     __mexception<_UNRECOGNIZED_SENDER_TYPE_<>, _WITH_SENDER_<_Sender>, _WITH_ENVIRONMENT_<_Env>...>;
52 } // namespace stdexec
53