just_from(fn) creates a sender that completes inline by passing a "sink" function to
fn. Calling the sink function with arguments sends the arguments as values to the receiver.
The sink function passed to fn must be called exactly once.
Example:
// The following sender is equivalent to just(42, 3.14):
auto sndr = exec::just_from([](auto sink) { return sink(42, 3.14); });
The function passed to just_from must return an instance of a specialization of
stdexec::completion_signatures<> that describes the ways the sink function might be
invoked. The sink function returns such a specialization of stdexec::completion_signatures<>
corresponding to the arguments passed to it, but if your function uses the sink function
in several different ways, you must specify the return type explicitly.
Example:
auto sndr = exec::just_from(
[](auto sink) {
if (some-condition) {
sink(42);
} else {
sink(3.14);
}
return stdexec::completion_signatures<stdexec::set_value_t(int),
stdexec::set_value_t(double)>{};
});
just_from(fn)
creates a sender that completes inline by passing a "sink" function tofn
. Calling the sink function with arguments sends the arguments as values to the receiver.The sink function passed to
fn
must be called exactly once.Example:
The function passed to
just_from
must return an instance of a specialization ofstdexec::completion_signatures<>
that describes the ways the sink function might be invoked. The sink function returns such a specialization ofstdexec::completion_signatures<>
corresponding to the arguments passed to it, but if your function uses the sink function in several different ways, you must specify the return type explicitly.Example: