beman.execution
importBeman P2300 sender/receiver execution library (native modules)
import beman.execution;
mcpp add beman.execution@0.3.0
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
import std;
import beman.execution;
namespace ex = beman::execution;
int main() {
bool ok = true;
auto check = [&](bool condition, const char* message) {
if (!condition) {
std::cerr << "FAIL: " << message << '\n';
ok = false;
}
};
auto value = ex::sync_wait(ex::just(20) | ex::then([](int n) { return n * 2 + 2; }));
check(value.has_value() && std::get<0>(*value) == 42, "just/then transforms a value");
auto joined = ex::sync_wait(ex::when_all(ex::just(17), ex::just(25)));
check(joined.has_value() && std::get<0>(*joined) + std::get<1>(*joined) == 42,
"when_all delivers both values");
bool ran = false;
auto stopped = ex::sync_wait(ex::just_stopped()
| ex::then([&] { ran = true; })
| ex::let_stopped([] { return ex::just(-1); }));
// …
tests/examples/beman-execution-module/tests/execution.cpp · 專案 tests/examples/beman-execution-module
建置
- modules
beman.execution, beman.execution.detail- targets
beman_execution (lib)- language
c++23- import std
- yes
- include dirs
*/include
原始檔 (2)
mcpp_generated/*.cppmmcpp_generated/execution.cpp
版本
| 版本 | 平台 | 鏡像 | sha256 |
|---|---|---|---|
0.3.0 最新 |
LinuxWindowsmacOS | 來源 | 0d39803334ac… |