13#include <rpp/sources/fwd.hpp>
14#include <rpp/sources/create.hpp>
15#include <rpp/schedulers/fwd.hpp>
16#include <rpp/schedulers/trampoline_scheduler.hpp>
21IMPLEMENTATION_FILE(interval_tag);
23namespace rpp::observable
45 template<schedulers::constraint::scheduler TScheduler >
46 auto interval(schedulers::duration period,
const TScheduler& scheduler )
requires rpp::details::is_header_included<rpp::details::interval_tag, TScheduler>
48 return interval(period, period, scheduler);
70 template<schedulers::constraint::scheduler TScheduler >
71 auto interval(schedulers::duration first_delay, schedulers::duration period,
const TScheduler& scheduler )
requires rpp::details::is_header_included<rpp::details::interval_tag, TScheduler>
73 return source::create<size_t>([first_delay, period, scheduler](
auto&& subscriber)
75 auto worker = scheduler.create_worker(subscriber.get_subscription());
76 worker.schedule(first_delay, [counter =
size_t{}, subscriber = std::forward<decltype(subscriber)>(subscriber), period]() mutable-> schedulers::optional_duration
78 subscriber.on_next(counter++);
auto interval(schedulers::duration period, const TScheduler &scheduler=TScheduler{})
Creates rpp::specific_observable which emits sequence of size_t every provided time interval.
Definition: interval.hpp:43