13#include <rpp/observables/details/member_overload.hpp>
14#include <rpp/observers/constraints.hpp>
23template<constra
int::decayed_type Type, constra
int::observer_of_type<Type> TObs>
26template<constra
int::decayed_type Type,
typename SpecificObservable>
45 template<constra
int::observer_of_type<Type> TObs>
46 auto tap(TObs&& observer)
const&
requires is_header_included <do_tag, TObs>
48 return static_cast<const SpecificObservable*
>(
this)->
template lift<Type>(
do_impl<Type, std::decay_t<TObs>>{std::forward< TObs>(observer)});
51 template<constra
int::observer_of_type<Type> TObs>
52 auto tap(TObs&& observer) &&
requires is_header_included <do_tag, TObs>
54 return std::move(*
static_cast<SpecificObservable*
>(
this)).template lift<Type>(
do_impl<Type, std::decay_t<TObs>>{std::forward< TObs>(observer)});
75 template<constra
int::on_next_fn<Type> OnNextFn, constra
int::on_error_fn OnErrorFn = utils::empty_function_t<std::exception_ptr>, constra
int::on_completed_fn OnCompletedFn = utils::empty_function_t<>>
76 auto tap(OnNextFn&& on_next, OnErrorFn&& on_error = OnErrorFn{}, OnCompletedFn&& on_completed = OnCompletedFn{})
const&
requires is_header_included <do_tag, OnNextFn, OnErrorFn, OnCompletedFn>
79 return static_cast<const SpecificObservable*
>(
this)->tap(TObserver{std::forward<OnNextFn>(on_next),
80 std::forward<OnErrorFn>(on_error),
81 std::forward<OnCompletedFn>(on_completed)});
84 template<constra
int::on_next_fn<Type> OnNextFn, constra
int::on_error_fn OnErrorFn = utils::empty_function_t<std::exception_ptr>, constra
int::on_completed_fn OnCompletedFn = utils::empty_function_t<>>
85 auto tap(OnNextFn&& on_next, OnErrorFn&& on_error = OnErrorFn{}, OnCompletedFn&& on_completed = OnCompletedFn{}) &&
requires is_header_included <do_tag, OnNextFn, OnErrorFn, OnCompletedFn>
87 using TObserver = specific_observer_with_decayed_args<Type, OnNextFn, OnErrorFn, OnCompletedFn>;
88 return std::move(*
static_cast<SpecificObservable*
>(
this)).tap(TObserver{std::forward<OnNextFn>(on_next),
89 std::forward<OnErrorFn>(on_error),
90 std::forward<OnCompletedFn>(on_completed)});
109 template<constra
int::on_next_fn<Type> OnNextFn>
110 auto do_on_next(OnNextFn&& on_next)
const&
requires is_header_included <do_tag, OnNextFn>
112 return static_cast<const SpecificObservable*
>(
this)->tap(std::forward<OnNextFn>(on_next));
115 template<constra
int::on_next_fn<Type> OnNextFn>
116 auto do_on_next(OnNextFn&& on_next) &&
requires is_header_included <do_tag, OnNextFn>
118 return std::move(*
static_cast<SpecificObservable*
>(
this)).tap(std::forward<OnNextFn>(on_next));
137 template<constra
int::on_error_fn OnErrorFn>
138 auto do_on_error(OnErrorFn&& on_error)
const&
requires is_header_included <do_tag, OnErrorFn>
140 return static_cast<const SpecificObservable*
>(
this)->tap(utils::empty_function_t<Type>{}, std::forward<OnErrorFn>(on_error));
143 template<constra
int::on_error_fn OnErrorFn>
144 auto do_on_error(OnErrorFn&& on_error) &&
requires is_header_included <do_tag, OnErrorFn>
146 return std::move(*
static_cast<SpecificObservable*
>(
this)).tap(utils::empty_function_t<Type>{}, std::forward<OnErrorFn>(on_error));
165 template<constra
int::on_completed_fn OnCompletedFn>
166 auto do_on_completed(OnCompletedFn&& on_completed)
const&
requires is_header_included <do_tag, OnCompletedFn>
168 return static_cast<const SpecificObservable*
>(
this)->tap(utils::empty_function_t<Type>{}, utils::empty_function_t<std::exception_ptr>{},std::forward<OnCompletedFn>(on_completed));
171 template<constra
int::on_completed_fn OnCompletedFn>
172 auto do_on_completed(OnCompletedFn&& on_completed) &&
requires is_header_included <do_tag, OnCompletedFn>
174 return std::move(*
static_cast<SpecificObservable*
>(
this)).tap(utils::empty_function_t<Type>{}, utils::empty_function_t<std::exception_ptr>{}, std::forward<OnCompletedFn>(on_completed));
Observer specified with specific template types of callbacks to avoid extra heap usage.
Definition: specific_observer.hpp:35
auto tap(TObs &&observer) const &
Register an observer to be called when observable provides any events (on_next/on_error/on_completed)
Definition: do.hpp:46
auto do_on_next(OnNextFn &&on_next) const &
Register an callback to be called when observable provides new item (on_next)
Definition: do.hpp:110
auto do_on_completed(OnCompletedFn &&on_completed) const &
Register an callback to be called when observable provides complete (on_completed)
Definition: do.hpp:166
auto tap(OnNextFn &&on_next, OnErrorFn &&on_error=OnErrorFn{}, OnCompletedFn &&on_completed=OnCompletedFn{}) const &
Register an list of actions to be called when observable provides any events (on_next/on_error/on_com...
Definition: do.hpp:76
auto do_on_error(OnErrorFn &&on_error) const &
Register an callback to be called when observable provides error (on_error)
Definition: do.hpp:138
Definition: member_overload.hpp:19