13#include <rpp/operators/fwd.hpp>
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/strategy.hpp>
18namespace rpp::operators::details
27 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
29 RPP_NO_UNIQUE_ADDRESS TObserver
observer;
30 RPP_NO_UNIQUE_ADDRESS OnNext onNext;
31 RPP_NO_UNIQUE_ADDRESS OnError onError;
32 RPP_NO_UNIQUE_ADDRESS OnCompleted onCompleted;
35 void on_next(T&& v)
const
37 onNext(utils::as_const(v));
41 void on_error(
const std::exception_ptr& err)
const
47 void on_completed()
const
66 template<rpp::constra
int::decayed_type T>
71 using result_type = T;
73 template<rpp::constra
int::observer_of_type<result_type> TObserver>
77 template<rpp::details::observables::constra
int::disposables_strategy Prev>
78 using updated_optimal_disposables_strategy = Prev;
82namespace rpp::operators
92 template<std::invocable<const std::exception_ptr&> OnError >
94 auto tap(OnError&& on_error)
101 std::forward<OnError>(on_error),
113 template<std::invocable<> OnCompleted >
114 auto tap(OnCompleted&& on_completed)
122 std::forward<OnCompleted>(on_completed)};
134 template<
typename OnNext,
135 std::invocable<> OnCompleted >
136 auto tap(OnNext&& on_next,
137 OnCompleted&& on_completed)
142 std::forward<OnNext>(on_next),
144 std::forward<OnCompleted>(on_completed)};
157 template<
typename OnNext ,
158 std::invocable<const std::exception_ptr&> OnError ,
159 std::invocable<> OnCompleted >
161 auto tap(OnNext&& on_next ,
163 OnCompleted&& on_completed )
166 std::forward<OnNext>(on_next),
167 std::forward<OnError>(on_error),
168 std::forward<OnCompleted>(on_completed)};
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:22
Definition constraints.hpp:50
Definition function_traits.hpp:45
auto tap(OnError &&on_error)
Register callbacks to inspect observable emissions and perform side-effects.
Definition tap.hpp:94
Definition functors.hpp:38
Definition functors.hpp:28