ReactivePlusPlus
ReactiveX implementation for C++20
Toggle main menu visibility
Loading...
Searching...
No Matches
timer.hpp
1
#pragma once
2
3
#include <rpp/sources/fwd.hpp>
4
5
#include <rpp/operators/take.hpp>
6
#include <rpp/sources/interval.hpp>
7
8
namespace
rpp::source
9
{
22
* @see https://reactivex.io/documentation/operators/timer.html
23
*/
24
template
<schedulers::constra
int
::scheduler TScheduler>
25
auto
timer
(rpp::schedulers::duration when, TScheduler&& scheduler)
26
{
27
return
interval
(when, rpp::schedulers::duration::zero(), std::forward<TScheduler>(scheduler)) |
operators::take
(1);
28
}
29
37
* @see https://reactivex.io/documentation/operators/timer.html
38
*/
39
template
<schedulers::constra
int
::scheduler TScheduler>
40
auto
timer
(rpp::schedulers::time_point when, TScheduler&& scheduler)
41
{
42
return
interval
(when, rpp::schedulers::duration::zero(), std::forward<TScheduler>(scheduler)) |
operators::take
(1);
43
}
44
}
// namespace rpp::source
rpp::source::interval
auto interval(rpp::schedulers::duration initial, rpp::schedulers::duration period, TScheduler &&scheduler)
Creates rpp::observable that emits a sequential integer every specified time interval,...
Definition
interval.hpp:72
rpp::source::timer
auto timer(rpp::schedulers::duration when, TScheduler &&scheduler)
Creates rpp::observable that emits an integer after a given delay, on the specified scheduler.
Definition
timer.hpp:22
rpp::operators::take
auto take(size_t count)
Emit only first count items provided by observable, then send on_completed.
Definition
take.hpp:92
src
rpp
rpp
sources
timer.hpp
Generated by
1.17.0