ulib/3party/rxcpp/Rx/v2/examples/doxygen/defer.cpp

17 lines
448 B
C++
Raw Normal View History

2024-01-10 09:33:36 +08:00
#include "rxcpp/rx.hpp"
#include "rxcpp/rx-test.hpp"
#include "catch.hpp"
SCENARIO("defer sample"){
printf("//! [defer sample]\n");
auto observable_factory = [](){return rxcpp::observable<>::range(1, 3);};
auto values = rxcpp::observable<>::defer(observable_factory);
values.
subscribe(
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
printf("//! [defer sample]\n");
}