13#include <rpp/operators/fwd.hpp>
15#include <rpp/defs.hpp>
16#include <rpp/operators/details/strategy.hpp>
18namespace rpp::operators::details
21 rpp::constraint::observer TObserver,
22 rpp::constraint::decayed_type OnNext,
23 rpp::constraint::decayed_type OnError,
24 rpp::constraint::decayed_type OnCompleted>
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));
38 observer.on_next(std::forward<T>(v));
41 void on_error(
const std::exception_ptr& err)
const
44 observer.on_error(err);
47 void on_completed()
const
50 observer.on_completed();
55 bool is_disposed()
const {
return observer.is_disposed(); }
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)};
Definition strategy.hpp:28
Definition constraints.hpp:22
Definition constraints.hpp:50
Definition function_traits.hpp:45
disposable_wrapper_impl< interface_disposable > disposable_wrapper
Wrapper to keep "simple" disposable. Specialization of rpp::disposable_wrapper_impl.
Definition fwd.hpp:34
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