|
ReactivePlusPlus
ReactiveX implementation for C++20
|
Filtering operators are operators that emit only part of items that satisfies some condition. More...
Functions | |
| auto | rpp::operators::distinct () |
| For each item from this observable, filter out repeated values and emit only items that have not already been emitted. | |
| template<typename EqualityFn> requires (!utils::is_not_template_callable<EqualityFn> || std::same_as<bool, std::invoke_result_t<EqualityFn, rpp::utils::convertible_to_any, rpp::utils::convertible_to_any>>) | |
| auto | rpp::operators::distinct_until_changed (EqualityFn &&equality_fn) |
| Suppress consecutive duplicates of emissions from original observable. | |
| auto | rpp::operators::element_at (size_t index) |
| Emit item located at specified index location in the sequence of items emitted by the source observable. | |
| template<typename Fn> requires (!utils::is_not_template_callable<Fn> || std::same_as<bool, std::invoke_result_t<Fn, rpp::utils::convertible_to_any>>) | |
| auto | rpp::operators::filter (Fn &&predicate) |
| Emit only those items from an Observable that satisfies a provided predicate. | |
| auto | rpp::operators::first () |
| Emit only the first item. | |
| auto | rpp::operators::last () |
| Emit only the last item provided before on_completed. | |
| auto | rpp::operators::skip (size_t count) |
| Skip first count items provided by observable then send rest items as expected. | |
| auto | rpp::operators::take (size_t count) |
| Emit only first count items provided by observable, then send on_completed. | |
| auto | rpp::operators::take_last (size_t count) |
| Emit only last count items provided by observable, then send on_completed. | |
| template<rpp::schedulers::constraint::scheduler Scheduler = rpp::schedulers::immediate> | |
| auto | rpp::operators::throttle (rpp::schedulers::duration period) |
| Emit emission from an Observable and then ignore subsequent values during duration of time. | |
Filtering operators are operators that emit only part of items that satisfies some condition.
|
inline |
For each item from this observable, filter out repeated values and emit only items that have not already been emitted.
| auto rpp::operators::distinct_until_changed | ( | EqualityFn && | equality_fn | ) |
Suppress consecutive duplicates of emissions from original observable.
Actually this operator has std::optional with last item and checks everytime where new emission is same or not.
| equality_fn | optional equality comparator function |
|
inline |
Emit item located at specified index location in the sequence of items emitted by the source observable.
If source observable completes without emitting at least index + 1 items, observable emits an error
| index | index of the item to return |
| auto rpp::operators::filter | ( | Fn && | predicate | ) |
Emit only those items from an Observable that satisfies a provided predicate.
Actually this operator just checks if predicate returns true, then forwards emission
| predicate | is predicate used to check emitted items. true -> items satisfies condition, false -> not |
|
inline |
Emit only the first item.
Actually this operator is take(1) with exception during on_completed if no any emision happens. So, it just forwards first obtained emission and emits on_completed immediately
| rpp::utils::not_enough_emissions | in case of on_completed obtained without any emissions |
|
inline |
Emit only the last item provided before on_completed.
Actually this operator just updates std::optional on every new emission and emits this value on_completed
| rpp::utils::not_enough_emissions | in case of on_completed obtained without any emissions |
|
inline |
Skip first count items provided by observable then send rest items as expected.
Actually this operator just decrements counter and starts to forward emissions when counter reaches zero.
| count | amount of items to be skipped |
|
inline |
Emit only first count items provided by observable, then send on_completed.
Actually this operator just emits emissions while counter is not zero and decrements counter on each emission
| count | amount of items to be emitted. 0 - instant complete |
|
inline |
Emit only last count items provided by observable, then send on_completed.
Actually this operator has buffer of requested size inside, keeps last count values and emit stored values on on_completed
| count | amount of last items to be emitted |
| auto rpp::operators::throttle | ( | rpp::schedulers::duration | period | ) |
Emit emission from an Observable and then ignore subsequent values during duration of time.
Actually this operator just keeps time of last emission, skips values until duration has passed, then forwards value, updates timepoint and etc...
| period | is period of time to skip subsequent emissions |
| Scheduler | is type used to determine now(). Shouldn't be used in production code |