diff --git a/include/nvexec/stream/split.cuh b/include/nvexec/stream/split.cuh index 2f5847f6e..b34760bdd 100644 --- a/include/nvexec/stream/split.cuh +++ b/include/nvexec/stream/split.cuh @@ -381,9 +381,26 @@ namespace nv::execution::_strm STDEXEC::completion_signatures()); } - auto get_env() const noexcept -> stream_sender_attrs + // Every completion of split_sender, including the set_error(cudaError_t) and + // set_stopped() completions it adds on its own, is delivered on the stream + // by propagate_completion_signal. Say so, rather than leaving the domains + // of the added channels for the child to (not) answer. + struct attrs : stream_sender_attrs { - return {&sndr_}; + using stream_sender_attrs::query; + + template <__one_of Tag> + STDEXEC_ATTRIBUTE(nodiscard) + constexpr auto query(get_completion_domain_t, __ignore = {}) const noexcept + -> stream_domain + { + return {}; + } + }; + + auto get_env() const noexcept -> attrs + { + return {{&sndr_}}; } private: diff --git a/include/stdexec/__detail/__remap_attrs.hpp b/include/stdexec/__detail/__remap_attrs.hpp new file mode 100644 index 000000000..33f3ce3a9 --- /dev/null +++ b/include/stdexec/__detail/__remap_attrs.hpp @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2026 NVIDIA Corporation + * + * Licensed under the Apache License Version 2.0 with LLVM Exceptions + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * https://llvm.org/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "__config.hpp" + +#if STDEXEC_USE_MODULES() && !defined(STDEXEC_IN_MODULE_PURVIEW) + +import stdexec; + +#else + +# include "__execution_fwd.hpp" + +// include these after __execution_fwd.hpp +# include "__completion_behavior.hpp" +# include "__concepts.hpp" +# include "__domain.hpp" +# include "__gather_completion_signatures.hpp" +# include "__get_completion_signatures.hpp" +# include "__meta.hpp" +# include "__query.hpp" +# include "__schedulers.hpp" +# include "__sender_concepts.hpp" + +# include "__prologue.hpp" + +// NOLINTNEXTLINE(bugprone-std-namespace-modification, modernize-concat-nested-namespaces) +namespace STDEXEC +{ + //! @brief Returns @c true if @c _Child is known, in environment @c _Env..., to + //! complete through the @c _From channel only with arguments for which the + //! metafunction @c _Pred yields @c true. Returns @c false if that cannot be + //! determined (e.g., the child is a dependent sender and no environment was + //! provided). + template + [[nodiscard]] + consteval auto __all_completions_satisfy() noexcept -> bool + { + if constexpr (sender_in<_Child, _Env...>) + { + return __gather_completion_signatures_t<_From, + __completion_signatures_of_t<_Child, _Env...>, + _Pred, + __qq<__mand_t>>::value; + } + else + { + return false; + } + } + + template + struct __nothrow_invocable_fn + { + template + using __f = __mbool<__nothrow_invocable<_Fun, _Args...>>; + }; + + //! @brief The attributes of a sender adaptor that does not introduce + //! asynchrony, but that may deliver a child's completion on a different + //! channel than the one the child used (e.g., @c upon_error turns an error + //! completion into a value completion). + //! + //! @tparam _Map A policy type with a static member function template + //! @code + //! template + //! static consteval bool __feeds() noexcept; + //! @endcode + //! that returns @c true if a @c _From completion of @c _Child can result in a + //! @c _Tag completion of the adaptor. + //! + //! The completion scheduler for a channel of the adaptor is the child's + //! completion scheduler for the one child channel that feeds it. If more than + //! one child channel can feed it, the completion scheduler is unknown. The + //! completion domain and completion behavior are the combination of those + //! of all the child channels that feed it. + //! + //! The adaptor connects its child with the receiver's environment unchanged, + //! so the child's attributes are queried with the same environment. + template + struct __remap_attrs + { + private: + // Whether a _From completion of the child can actually result in a _Tag + // completion of the adaptor. A child channel that is known never to be used + // does not count. + template + static constexpr bool __feeds_v = _Map::template __feeds<_Tag, _From, _Child, _Env...>() + && !__never_sends<_From, _Child, _Env...>; + + // The child channels that can feed the adaptor's _Tag channel, applied to + // _Fn. + template + using __sources_t = + __mcall<__mconcat<_Fn>, + __if_c<__feeds_v<_Tag, set_value_t, _Env...>, __mlist, __mlist<>>, + __if_c<__feeds_v<_Tag, set_error_t, _Env...>, __mlist, __mlist<>>, + __if_c<__feeds_v<_Tag, set_stopped_t, _Env...>, __mlist, __mlist<>>>; + + template + struct __domain_fn + { + template + using __f = + __common_domain_t<__completion_domain_t<_From, env_of_t<_Child>, _Env const &...>...>; + }; + + template + using __source_t = __sources_t<__q<__mfront>, _Tag, _Env...>; + + template + static constexpr std::size_t __source_count_v = __sources_t<__msize, _Tag, _Env...>::value; + + template + struct __behavior_fn + { + template + static constexpr auto __value() noexcept + { + if constexpr (sizeof...(_From) == 0) + { + return __completion_behavior::__unknown; + } + else + { + return __completion_behavior::__common( + STDEXEC::__get_completion_behavior<_From, _Child, _Env...>()...); + } + } + + template + using __f = decltype(__value<_From...>()); + }; + + public: + template + requires(__source_count_v<_Tag, _Env...> == 1) + && __callable>, + env_of_t<_Child>, + _Env const &...> + [[nodiscard]] + constexpr auto query(get_completion_scheduler_t<_Tag>, _Env const &...__env) const noexcept + { + return get_completion_scheduler<__source_t<_Tag, _Env...>>(get_env(__child_), __env...); + } + + template + requires(__source_count_v<_Tag, _Env...> != 0) + [[nodiscard]] + constexpr auto query(get_completion_domain_t<_Tag>, _Env const &...) const noexcept + -> __ensure_valid_domain_t<__sources_t<__domain_fn<_Env...>, _Tag, _Env...>> + { + return {}; + } + + template + [[nodiscard]] + constexpr auto query(__get_completion_behavior_t<_Tag>, _Env const &...) const noexcept + { + return __sources_t<__behavior_fn<_Env...>, _Tag, _Env...>{}; + } + + template , __forwarding_query _Query, class... _Args> + requires(!__completion_query<_Query>) && __queryable_with<_Attrs, _Query, _Args...> + [[nodiscard]] + constexpr auto query(_Query, _Args &&...__args) const + noexcept(__nothrow_queryable_with<_Attrs, _Query, _Args...>) + -> __query_result_t<_Attrs, _Query, _Args...> + { + return get_env(__child_).query(_Query(), static_cast<_Args &&>(__args)...); + } + + _Child const &__child_; + }; + + //! @brief A policy for @c __remap_attrs for adaptors like @c then, + //! @c upon_error, and @c upon_stopped, which pass the @c _SetTag completions + //! of the child to @c _Fun and complete with the result on the @c set_value + //! channel (or with @c set_error if @c _Fun throws). Other completions are + //! passed through unchanged. + template + struct __upon_channel_map + { + template + [[nodiscard]] + static consteval auto __feeds() noexcept -> bool + { + if constexpr (__same_as<_From, _SetTag>) + { + // Only check whether _Fun can throw when it matters, so that we don't + // needlessly instantiate _Fun's call operator. + if constexpr (__same_as<_Tag, set_error_t>) + { + return !STDEXEC::__all_completions_satisfy<_From, + _Child, + __nothrow_invocable_fn<_Fun>, + _Env...>(); + } + else + { + return __same_as<_Tag, set_value_t>; + } + } + else + { + return __same_as<_Tag, _From>; + } + } + }; +} // namespace STDEXEC + +# include "__epilogue.hpp" +#endif // !STDEXEC_USE_MODULES() || defined(STDEXEC_IN_MODULE_PURVIEW) diff --git a/include/stdexec/__detail/__stopped_as_error.hpp b/include/stdexec/__detail/__stopped_as_error.hpp index 7a0ea5b24..48259629f 100644 --- a/include/stdexec/__detail/__stopped_as_error.hpp +++ b/include/stdexec/__detail/__stopped_as_error.hpp @@ -33,6 +33,7 @@ import stdexec; # include "__just.hpp" # include "__let.hpp" # include "__queries.hpp" +# include "__remap_attrs.hpp" # include "__sender_adaptor_closure.hpp" # include "__senders.hpp" @@ -191,13 +192,35 @@ namespace STDEXEC //! @hideinitializer inline constexpr stopped_as_error_t stopped_as_error{}; + namespace __sae + { + // A stopped completion of the child becomes an error completion. Value and + // error completions are passed through unchanged. + struct __channel_map + { + template + [[nodiscard]] + static consteval auto __feeds() noexcept -> bool + { + if constexpr (__same_as<_From, set_stopped_t>) + { + return __same_as<_Tag, set_error_t>; + } + else + { + return __same_as<_Tag, _From>; + } + } + }; + } // namespace __sae + template <> struct __sexpr_impl : __sexpr_defaults { static constexpr auto __get_attrs = [](__ignore, __ignore, _Child const & __child) noexcept { - return __sync_attrs{__child}; + return __remap_attrs<__sae::__channel_map, _Child>{__child}; }; template diff --git a/include/stdexec/__detail/__stopped_as_optional.hpp b/include/stdexec/__detail/__stopped_as_optional.hpp index 1ec56ab31..2a06f9cd5 100644 --- a/include/stdexec/__detail/__stopped_as_optional.hpp +++ b/include/stdexec/__detail/__stopped_as_optional.hpp @@ -32,6 +32,7 @@ import stdexec; # include "__concepts.hpp" # include "__diagnostics.hpp" # include "__receivers.hpp" +# include "__remap_attrs.hpp" # include "__sender_adaptor_closure.hpp" # include "__senders.hpp" # include "__transform_completion_signatures.hpp" @@ -61,8 +62,49 @@ namespace STDEXEC _Receiver __rcvr_; }; + // A stopped completion of the child becomes a value completion (an empty + // optional). Value completions stay value completions, but they can turn + // into an error completion if decay-copying the value into the optional + // throws. + struct __channel_map + { + template + [[nodiscard]] + static consteval auto __feeds() noexcept -> bool + { + if constexpr (__same_as<_From, set_stopped_t>) + { + return __same_as<_Tag, set_value_t>; + } + else if constexpr (__same_as<_From, set_value_t>) + { + if constexpr (__same_as<_Tag, set_error_t>) + { + return !STDEXEC::__all_completions_satisfy, + _Env...>(); + } + else + { + return __same_as<_Tag, set_value_t>; + } + } + else + { + return __same_as<_Tag, _From>; + } + } + }; + struct __stopped_as_optional_impl : __sexpr_defaults { + static constexpr auto __get_attrs = + [](__ignore, __ignore, _Child const & __child) noexcept + { + return __remap_attrs<__channel_map, _Child>{__child}; + }; + static consteval auto __get_value_transform_fn() noexcept { return []() diff --git a/include/stdexec/__detail/__then.hpp b/include/stdexec/__detail/__then.hpp index 27b724df2..7ff32e310 100644 --- a/include/stdexec/__detail/__then.hpp +++ b/include/stdexec/__detail/__then.hpp @@ -28,6 +28,7 @@ import stdexec; # include "__basic_sender.hpp" # include "__meta.hpp" # include "__queries.hpp" +# include "__remap_attrs.hpp" # include "__sender_adaptor_closure.hpp" # include "__sender_introspection.hpp" # include "__senders.hpp" @@ -46,9 +47,9 @@ namespace STDEXEC struct __impl : __sexpr_defaults { static constexpr auto __get_attrs = - [](__ignore, __ignore, _Child const & __child) noexcept + [](__ignore, _Fun const &, _Child const & __child) noexcept { - return __sync_attrs{__child}; + return __remap_attrs<__upon_channel_map, _Child>{__child}; }; template diff --git a/include/stdexec/__detail/__upon_error.hpp b/include/stdexec/__detail/__upon_error.hpp index 7c4bdc2b2..5deae7e62 100644 --- a/include/stdexec/__detail/__upon_error.hpp +++ b/include/stdexec/__detail/__upon_error.hpp @@ -28,6 +28,7 @@ import stdexec; # include "__basic_sender.hpp" # include "__meta.hpp" # include "__queries.hpp" +# include "__remap_attrs.hpp" # include "__sender_adaptor_closure.hpp" # include "__sender_introspection.hpp" # include "__senders.hpp" @@ -46,9 +47,9 @@ namespace STDEXEC struct __impl : __sexpr_defaults { static constexpr auto __get_attrs = - [](__ignore, __ignore, _Child const & __child) noexcept + [](__ignore, _Fun const &, _Child const & __child) noexcept { - return __sync_attrs{__child}; + return __remap_attrs<__upon_channel_map, _Child>{__child}; }; template diff --git a/include/stdexec/__detail/__upon_stopped.hpp b/include/stdexec/__detail/__upon_stopped.hpp index 80c721d3c..bec6a2cfc 100644 --- a/include/stdexec/__detail/__upon_stopped.hpp +++ b/include/stdexec/__detail/__upon_stopped.hpp @@ -26,6 +26,7 @@ import stdexec; # include "__execution_fwd.hpp" # include "__basic_sender.hpp" +# include "__remap_attrs.hpp" # include "__sender_adaptor_closure.hpp" # include "__sender_introspection.hpp" # include "__senders.hpp" @@ -43,6 +44,12 @@ namespace STDEXEC { struct __impl : __sexpr_defaults { + static constexpr auto __get_attrs = + [](__ignore, _Fun const &, _Child const & __child) noexcept + { + return __remap_attrs<__upon_channel_map, _Child>{__child}; + }; + template static consteval auto __get_completion_signatures() { diff --git a/test/stdexec/algos/adaptors/test_stopped_as_error.cpp b/test/stdexec/algos/adaptors/test_stopped_as_error.cpp index 2d45569fb..61ed11ab6 100644 --- a/test/stdexec/algos/adaptors/test_stopped_as_error.cpp +++ b/test/stdexec/algos/adaptors/test_stopped_as_error.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #if STDEXEC_USE_MODULES() @@ -184,4 +185,30 @@ namespace auto op = ex::connect(std::move(snd), expect_error_receiver{-114514}); ex::start(op); } + + TEST_CASE("stopped_as_error reports the completion scheduler of the child channel that feeds " + "each channel", + "[adaptors][stopped_as_error]") + { + ex::run_loop loop1, loop2, loop3; + auto sch1 = loop1.get_scheduler(); + auto sch2 = loop2.get_scheduler(); + auto sch3 = loop3.get_scheduler(); + + SECTION("with a child that can complete on every channel") + { + auto sndr = make_per_channel_scheduler_sender(sch1, sch2, sch3); + auto snd = sndr | ex::stopped_as_error(-1); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch1); + STATIC_REQUIRE(!has_completion_scheduler); + STATIC_REQUIRE(!has_completion_scheduler); + } + + SECTION("with a child that only completes with stopped") + { + ex::prop env{ex::get_start_scheduler, sch1}; + auto snd = ex::just_stopped() | ex::stopped_as_error(-1); + CHECK(ex::get_completion_scheduler(ex::get_env(snd), env) == sch1); + } + } } // namespace diff --git a/test/stdexec/algos/adaptors/test_stopped_as_optional.cpp b/test/stdexec/algos/adaptors/test_stopped_as_optional.cpp index 60040d459..bf4f3b8d9 100644 --- a/test/stdexec/algos/adaptors/test_stopped_as_optional.cpp +++ b/test/stdexec/algos/adaptors/test_stopped_as_optional.cpp @@ -156,4 +156,30 @@ namespace check_sends_stopped(ex::just(2) | ex::continues_on(sched2) | ex::stopped_as_optional()); check_sends_stopped(ex::just(3) | ex::continues_on(sched3) | ex::stopped_as_optional()); } + + TEST_CASE("stopped_as_optional reports the completion scheduler of the child channel that " + "feeds each channel", + "[adaptors][stopped_as_optional]") + { + ex::run_loop loop1, loop2, loop3; + auto sch1 = loop1.get_scheduler(); + auto sch2 = loop2.get_scheduler(); + auto sch3 = loop3.get_scheduler(); + + SECTION("with a child that can complete on every channel") + { + auto sndr = make_per_channel_scheduler_sender(sch1, sch2, sch3); + auto snd = sndr | ex::stopped_as_optional(); + STATIC_REQUIRE(!has_completion_scheduler); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch2); + STATIC_REQUIRE(!has_completion_scheduler); + } + + SECTION("with a child that only completes with a value or stopped") + { + ex::prop env{ex::get_start_scheduler, sch1}; + auto snd = ex::just(42) | ex::stopped_as_optional(); + CHECK(ex::get_completion_scheduler(ex::get_env(snd), env) == sch1); + } + } } // namespace diff --git a/test/stdexec/algos/adaptors/test_then.cpp b/test/stdexec/algos/adaptors/test_then.cpp index 1292d522d..3918fb154 100644 --- a/test/stdexec/algos/adaptors/test_then.cpp +++ b/test/stdexec/algos/adaptors/test_then.cpp @@ -244,4 +244,40 @@ namespace | ex::write_env(ex::prop{ex::get_scheduler, inline_scheduler()}); wait_for_value(std::move(snd), std::string{"ciao"}); } + + TEST_CASE("then reports the completion scheduler of the child channel that feeds each channel", + "[adaptors][then]") + { + ex::run_loop loop1, loop2, loop3; + auto sch1 = loop1.get_scheduler(); + auto sch2 = loop2.get_scheduler(); + auto sch3 = loop3.get_scheduler(); + auto sndr = make_per_channel_scheduler_sender(sch1, sch2, sch3); + + SECTION("with a function that does not throw") + { + auto snd = sndr | ex::then([](int) noexcept { return 0; }); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch1); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch2); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch3); + } + + SECTION("with a function that may throw") + { + // An error can come from the child's error channel or from the function + // throwing on the child's value channel, so it is not known where an + // error completion happens. + auto snd = sndr | ex::then([](int) { return 0; }); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch1); + STATIC_REQUIRE(!has_completion_scheduler); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch3); + } + + SECTION("with a child that only completes with an error") + { + ex::prop env{ex::get_start_scheduler, sch1}; + auto snd = ex::just_error(42) | ex::then([]() { return 0; }); + CHECK(ex::get_completion_scheduler(ex::get_env(snd), env) == sch1); + } + } } // namespace diff --git a/test/stdexec/algos/adaptors/test_upon_error.cpp b/test/stdexec/algos/adaptors/test_upon_error.cpp index 9dab98d8f..df39685da 100644 --- a/test/stdexec/algos/adaptors/test_upon_error.cpp +++ b/test/stdexec/algos/adaptors/test_upon_error.cpp @@ -19,6 +19,7 @@ #include #include +#include #include namespace ex = STDEXEC; @@ -158,4 +159,42 @@ namespace completion_sigs>); } } + + TEST_CASE("upon_error reports the completion scheduler of the child channel that feeds each " + "channel", + "[adaptors][upon_error]") + { + ex::run_loop loop1, loop2, loop3; + auto sch1 = loop1.get_scheduler(); + auto sch2 = loop2.get_scheduler(); + auto sch3 = loop3.get_scheduler(); + auto sndr = make_per_channel_scheduler_sender(sch1, sch2, sch3); + + SECTION("with a function that does not throw") + { + // A value can come from the child's value channel or from its error + // channel, so it is not known where a value completion happens. + auto snd = sndr | ex::upon_error([](int) noexcept { return 0; }); + STATIC_REQUIRE(!has_completion_scheduler); + STATIC_REQUIRE(!has_completion_scheduler); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch3); + } + + SECTION("with a function that may throw") + { + auto snd = sndr | ex::upon_error([](int) { return 0; }); + STATIC_REQUIRE(!has_completion_scheduler); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch2); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch3); + } + + SECTION("with a child that only completes with an error") + { + // The value completion comes from the child's error completion, which + // happens inline on the starting scheduler. + ex::prop env{ex::get_start_scheduler, sch1}; + auto snd = ex::just_error(-1) | ex::upon_error([](int i) noexcept { return i; }); + CHECK(ex::get_completion_scheduler(ex::get_env(snd), env) == sch1); + } + } } // namespace diff --git a/test/stdexec/algos/adaptors/test_upon_stopped.cpp b/test/stdexec/algos/adaptors/test_upon_stopped.cpp index 2aad13e4c..d8b1b92ba 100644 --- a/test/stdexec/algos/adaptors/test_upon_stopped.cpp +++ b/test/stdexec/algos/adaptors/test_upon_stopped.cpp @@ -19,6 +19,7 @@ #include #include +#include #include namespace ex = STDEXEC; @@ -56,4 +57,38 @@ namespace // we also check that the function was invoked CHECK(called); } + + TEST_CASE("upon_stopped reports the completion scheduler of the child channel that feeds each " + "channel", + "[adaptors][upon_stopped]") + { + ex::run_loop loop1, loop2, loop3; + auto sch1 = loop1.get_scheduler(); + auto sch2 = loop2.get_scheduler(); + auto sch3 = loop3.get_scheduler(); + auto sndr = make_per_channel_scheduler_sender(sch1, sch2, sch3); + + SECTION("with a function that does not throw") + { + auto snd = sndr | ex::upon_stopped([]() noexcept { return 0; }); + STATIC_REQUIRE(!has_completion_scheduler); + CHECK(ex::get_completion_scheduler(ex::get_env(snd)) == sch2); + STATIC_REQUIRE(!has_completion_scheduler); + } + + SECTION("with a function that may throw") + { + auto snd = sndr | ex::upon_stopped([]() { return 0; }); + STATIC_REQUIRE(!has_completion_scheduler); + STATIC_REQUIRE(!has_completion_scheduler); + STATIC_REQUIRE(!has_completion_scheduler); + } + + SECTION("with a child that only completes with stopped") + { + ex::prop env{ex::get_start_scheduler, sch1}; + auto snd = ex::just_stopped() | ex::upon_stopped([]() noexcept { return 1; }); + CHECK(ex::get_completion_scheduler(ex::get_env(snd), env) == sch1); + } + } } // namespace diff --git a/test/test_common/senders.hpp b/test/test_common/senders.hpp index 405af357f..5d84da149 100644 --- a/test/test_common/senders.hpp +++ b/test/test_common/senders.hpp @@ -367,6 +367,84 @@ namespace Type& value_; }; + //! A sender that can complete on any of the three channels, and that + //! advertises a (possibly different) completion scheduler for each of them. + //! Used to test how sender adaptors report completion schedulers. + template + struct per_channel_scheduler_sender + { + using sender_concept = ex::sender_tag; + using completion_signatures = + ex::completion_signatures; + + struct attrs + { + [[nodiscard]] + auto query(ex::get_completion_scheduler_t) const noexcept -> ValueSched + { + return value_sched_; + } + + [[nodiscard]] + auto query(ex::get_completion_scheduler_t) const noexcept -> ErrorSched + { + return error_sched_; + } + + [[nodiscard]] + auto query(ex::get_completion_scheduler_t) const noexcept -> StoppedSched + { + return stopped_sched_; + } + + ValueSched value_sched_; + ErrorSched error_sched_; + StoppedSched stopped_sched_; + }; + + template + struct operation + { + void start() & noexcept + { + ex::set_stopped(static_cast(rcvr_)); + } + + Receiver rcvr_; + }; + + template + auto connect(Receiver rcvr) const -> operation + { + return {static_cast(rcvr)}; + } + + [[nodiscard]] + auto get_env() const noexcept -> attrs + { + return attrs_; + } + + attrs attrs_; + }; + + template + auto make_per_channel_scheduler_sender(ValueSched value_sched, + ErrorSched error_sched, + StoppedSched stopped_sched) + -> per_channel_scheduler_sender + { + return { + {value_sched, error_sched, stopped_sched} + }; + } + + template + inline constexpr bool has_completion_scheduler = requires(Sender const & sndr, + Env const &... env) { + ex::get_completion_scheduler(ex::get_env(sndr), env...); + }; + } // namespace #include