What is RescheduleLazy and how to create it
mainA RescheduleLazy is a Lazy that is bound to an Executor. When a RescheduleLazy is started (via .start or syncAwait), the task that wakes it up is submitted to the bound Executor.
You cannot create a RescheduleLazy directly. You must create it using the .via(executor) interface on an existing Lazy object.
void foo() {
executors::SimpleExecutor e1(1);
auto addOne = [&](int x) -> Lazy<int> {
auto tmp = co_await getValue(x);
co_return tmp + 2;
};
// Create RescheduleLazy using .via()
RescheduleLazy Scheduled = addOne().via(&e1);
syncAwait(Scheduled);
}