13#include <rpp/utils/function_traits.hpp>
14#include <rpp/utils/functors.hpp>
15#include <rpp/observers/state_observer.hpp>
30template<constraint::decayed_type T,
31 constraint::on_next_fn<T> OnNext = utils::empty_function_t<T>,
32 constraint::on_error_fn OnError = utils::rethrow_error_t,
33 constraint::on_completed_fn OnCompleted = utils::empty_function_t<>>
40 template<constra
int::on_next_fn<T> TOnNext = utils::empty_function_t<T>,
41 constra
int::on_error_fn TOnError = utils::rethrow_error_t,
42 constra
int::on_completed_fn TOnCompleted = utils::empty_function_t<>>
50 utils::rethrow_error_t{},
61template<
typename OnNext>
62specific_observer(OnNext) -> specific_observer<utils::decayed_function_argument_t<OnNext>, OnNext>;
64template<
typename OnNext, constraint::on_error_fn OnError,
typename ...Args>
65specific_observer(OnNext, OnError, Args...) -> specific_observer<utils::decayed_function_argument_t<OnNext>, OnNext, OnError, Args...>;
67template<
typename OnNext, constra
int::on_completed_fn OnCompleted>
68specific_observer(OnNext, OnCompleted) -> specific_observer<utils::decayed_function_argument_t<OnNext>, OnNext, utils::rethrow_error_t, OnCompleted>;
74template<constra
int::decayed_type Type>
75auto make_specific_observer() -> specific_observer_with_decayed_args<Type>
80template<constra
int::decayed_type Type, constra
int::on_next_fn<Type> OnNext>
81auto make_specific_observer( OnNext&& on_next) -> specific_observer_with_decayed_args<Type, OnNext>
83 return {std::forward<OnNext>(on_next)};
86template<constra
int::decayed_type Type, constra
int::on_next_fn<Type> OnNext, constra
int::on_completed_fn OnCompleted>
87auto make_specific_observer(OnNext&& on_next, OnCompleted&& on_completed) -> specific_observer_with_decayed_args<Type, OnNext, utils::rethrow_error_t, OnCompleted>
89 return {std::forward<OnNext>(on_next), std::forward<OnCompleted>(on_completed)};
92template<constra
int::decayed_type Type, constra
int::on_next_fn<Type> OnNext, constra
int::on_error_fn OnError>
93auto make_specific_observer(OnNext&& on_next,
94 OnError&& on_error) -> specific_observer_with_decayed_args<Type, OnNext, OnError>
96 return {std::forward<OnNext>(on_next), std::forward<OnError>(on_error)};
99template<constra
int::decayed_type Type, constra
int::on_next_fn<Type> OnNext, constra
int::on_error_fn OnError, constra
int::on_completed_fn OnCompleted>
100auto make_specific_observer(OnNext&& on_next,
102 OnCompleted&& on_completed) -> specific_observer_with_decayed_args<Type, OnNext, OnError, OnCompleted>
104 return {std::forward<OnNext>(on_next),
105 std::forward<OnError>(on_error),
106 std::forward<OnCompleted>(on_completed)};
112 template<constraint::decayed_type Type,
typename ...Args>
113 using deduce_specific_observer_type_t =
decltype(make_specific_observer<Type>(std::declval<Args>()...));
Special type of specific_observer which has some state which this observer stores and pass to each ca...
Definition: state_observer.hpp:34
void on_next(const T &v) const
Observable calls this methods to notify observer about new value.
Definition: state_observer.hpp:52
void on_completed() const
Observable calls this method to notify observer about finish of work.
Definition: state_observer.hpp:81
void on_error(const std::exception_ptr &err) const
Observable calls this method to notify observer about some error during generation next data.
Definition: state_observer.hpp:72
Dynamic (type-erased) version of observer (comparing to specific_observer)
Definition: dynamic_observer.hpp:109
Observer specified with specific template types of callbacks to avoid extra heap usage.
Definition: specific_observer.hpp:35
auto as_dynamic() const &
Converting current rpp::specific_observer to rpp::dynamic_observer alternative with erasing of type (...
Definition: specific_observer.hpp:57