13#include <rpp/operators/fwd.hpp>
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/strategy.hpp>
18namespace rpp::operators::details
20 template<rpp::constra
int::observer TObserver>
29 RPP_NO_UNIQUE_ADDRESS TObserver
observer;
32 template<rpp::constra
int::observer TObserver>
35 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
40 void on_next(T&& v)
const
45 void on_error(
const std::exception_ptr& err)
const
50 void on_completed()
const
61 template<rpp::constra
int::observer TObserver, rpp::constra
int::decayed_type Selector>
64 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
67 : state{init_state(std::move(
observer))}
72 std::shared_ptr<on_error_resume_next_disposable<TObserver>> state;
73 RPP_NO_UNIQUE_ADDRESS Selector selector;
76 void on_next(T&& v)
const
78 state->observer.on_next(std::forward<T>(v));
81 void on_error(
const std::exception_ptr& err)
const
89 state->observer.on_error(std::current_exception());
94 void on_completed()
const
96 state->observer.on_completed();
104 bool is_disposed()
const {
return state->is_disposed(); }
106 static std::shared_ptr<on_error_resume_next_disposable<TObserver>> init_state(TObserver&&
observer)
110 ptr->observer.set_upstream(d.as_weak());
115 template<rpp::constra
int::decayed_type Selector>
120 template<rpp::constra
int::decayed_type T>
123 using selector_observable_result_type =
124 rpp::utils::extract_observable_type_t<std::invoke_result_t<Selector, std::exception_ptr>>;
128 "Selector observable result type is not the same as T");
130 using result_type = T;
132 template<rpp::constra
int::observer_of_type<result_type> TObserver>
136 template<rpp::details::observables::constra
int::disposables_strategy Prev>
141namespace rpp::operators
159 template<
typename Selector>
Disposable which can keep some other sub-disposables. When this root disposable is disposed,...
Definition composite_disposable.hpp:175
void on_next(const Type &v) const noexcept
Observable calls this method to notify observer about new value.
Definition observer.hpp:84
void set_upstream(const disposable_wrapper &d) noexcept
Observable calls this method to pass disposable. Observer disposes this disposable WHEN observer want...
Definition observer.hpp:49
void on_completed() const noexcept
Observable calls this method to notify observer about completion of emissions.
Definition observer.hpp:135
void on_error(const std::exception_ptr &err) const noexcept
Observable calls this method to notify observer about some error during generation next data.
Definition observer.hpp:120
bool is_disposed() const noexcept
Observable calls this method to check if observer interested or not in emissions.
Definition observer.hpp:74
Base class for any observer used in RPP. It handles core callbacks of observers. Objects of this clas...
Definition observer.hpp:172
Definition strategy.hpp:28
Definition constraints.hpp:19
auto on_error_resume_next(Selector &&selector)
If an error occurs, take the result from the Selector and subscribe to that instead.
Definition on_error_resume_next.hpp:157
Definition disposables_strategy.hpp:19
Definition on_error_resume_next.hpp:22
Definition on_error_resume_next.hpp:34
Definition on_error_resume_next.hpp:63
Definition on_error_resume_next.hpp:122
Definition on_error_resume_next.hpp:117