ulib/3party/rxcpp/Rx/v2/examples/doxygen/sample.cpp
2024-01-10 09:33:36 +08:00

19 lines
516 B
C++

#include "rxcpp/rx.hpp"
#include "rxcpp/rx-test.hpp"
#include "catch.hpp"
SCENARIO("sample period sample") {
printf("//! [sample period sample]\n");
auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).
take(7).
sample_with_time(std::chrono::milliseconds(4));
values.
subscribe(
[](long v) {
printf("OnNext: %ld\n", v);
},
[]() { printf("OnCompleted\n"); });
printf("//! [sample period sample]\n");
}