* @example take_until.cpp **/
| 7 | * @example take_until.cpp |
| 8 | **/ |
| 9 | int main() |
| 10 | { |
| 11 | //! [take_until] |
| 12 | rpp::source::interval(std::chrono::seconds{1}, rpp::schedulers::current_thread{}) |
| 13 | | rpp::ops::take_until(rpp::source::interval(std::chrono::seconds{5}, rpp::schedulers::current_thread{})) |
| 14 | | rpp::ops::subscribe([](int v) { std::cout << "-" << v; }, |
| 15 | [](const std::exception_ptr&) { std::cout << "-x" << std::endl; }, |
| 16 | []() { std::cout << "-|" << std::endl; }); |
| 17 | // source 1: -0-1-2-3-4-5-6-7- -- |
| 18 | // source 2: ---------0---------1- -- |
| 19 | // Output : -0-1-2-3-| |
| 20 | //! [take_until] |
| 21 | |
| 22 | //! [terminate] |
| 23 | rpp::source::never<int>() |
| 24 | | rpp::ops::take_until(rpp::source::error<bool>(std::make_exception_ptr(std::runtime_error{""}))) |
| 25 | | rpp::ops::subscribe([](int v) { std::cout << "-" << v; }, |
| 26 | [](const std::exception_ptr&) { std::cout << "-x" << std::endl; }, |
| 27 | []() { std::cout << "-|" << std::endl; }); |
| 28 | // source 1: - |
| 29 | // source 2: -x |
| 30 | // Output : -x |
| 31 | //! [terminate] |
| 32 | return 0; |
| 33 | } |
nothing calls this directly
no test coverage detected