13#include <rpp/disposables/fwd.hpp>
14#include <rpp/observers/details/fwd.hpp>
16#include <rpp/utils/constraints.hpp>
17#include <rpp/utils/function_traits.hpp>
18#include <rpp/utils/functors.hpp>
19#include <rpp/utils/utils.hpp>
23namespace rpp::constraint
29 const_strategy.on_error(std::exception_ptr{});
30 const_strategy.on_completed();
32 strategy.set_upstream(disposable);
34 strategy.is_disposed()
35 } -> std::same_as<bool>;
55 template<
typename S,
typename Type>
57 const_strategy.on_next(v);
58 const_strategy.on_next(std::move(mv));
67namespace rpp::details::observers
69 template<rpp::constra
int::decayed_type Type>
73 std::invocable<Type> OnNext,
74 std::invocable<const std::exception_ptr&> OnError,
75 std::invocable<> OnCompleted>
78 template<rpp::constra
int::observer_strategy_base S, rpp::details::observers::constra
int::disposables_strategy DisposableStrategy>
81 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::Auto;
85 consteval static void on_next(
const auto&)
noexcept {}
86 consteval static void on_error(
const std::exception_ptr&)
noexcept {}
87 consteval static void on_completed()
noexcept {}
90 consteval static bool is_disposed()
noexcept {
return false; }
95 template<constra
int::decayed_type Type, constra
int::observer_strategy<Type> Strategy>
102 template<constra
int::decayed_type Type, constra
int::observer_strategy<Type> Strategy>
105 template<constra
int::decayed_type Type>
118 template<constra
int::decayed_type Type, std::invocable<Type> OnNext, std::invocable<const std::exception_ptr&> OnError, std::invocable<> OnCompleted>
125 template<constra
int::decayed_type Type, std::invocable<Type> OnNext, std::invocable<const std::exception_ptr&> OnError, std::invocable<> OnCompleted>
139 std::invocable<Type> OnNext,
143 OnError&& on_error = {},
145 std::decay_t<OnNext>,
146 std::decay_t<OnError>,
147 std::decay_t<OnCompleted>>;
160 template<constraint::decayed_type Type,
161 std::invocable<Type> OnNext,
166 OnError&& on_error = {},
167 OnCompleted&& on_completed = {}) -> lambda_observer_with_external_disposable<Type,
168 std::decay_t<OnNext>,
169 std::decay_t<OnError>,
170 std::decay_t<OnCompleted>>;
182 template<
typename OnNext,
185 constraint::decayed_type Type = rpp::utils::decayed_function_argument_t<OnNext>>
186 requires std::invocable<OnNext, Type>
188 OnError&& on_error = {},
189 OnCompleted&& on_completed = {})
191 return make_lambda_observer<Type>(std::forward<OnNext>(on_next), std::forward<OnError>(on_error), std::forward<OnCompleted>(on_completed));
206 template<
typename OnNext,
209 constraint::decayed_type Type = rpp::utils::decayed_function_argument_t<OnNext>>
210 requires std::invocable<OnNext, Type>
213 OnError&& on_error = {},
214 OnCompleted&& on_completed = {})
216 return make_lambda_observer<Type>(d, std::forward<OnNext>(on_next), std::forward<OnError>(on_error), std::forward<OnCompleted>(on_completed));
220namespace rpp::details::observers
224 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::None;
226 static void on_next(
const auto&)
noexcept {}
228 static void on_error(
const std::exception_ptr&)
noexcept {}
230 static void on_completed()
noexcept {}
234 static bool is_disposed()
noexcept {
return true; }
244 using extract_observer_type_t =
typename rpp::utils::extract_base_type_params_t<T, rpp::observer>::template type_at_index_t<0>;
247namespace rpp::constraint
252 template<
typename T,
typename Type>
Type-erased version of the rpp::observer. Any observer can be converted to dynamic_observer via rpp::...
Definition fwd.hpp:106
Base class for any observer used in RPP. It handles core callbacks of observers. Objects of this clas...
Definition observer.hpp:172
Definition constraints.hpp:19
Definition constraints.hpp:22
Concept defines requirements for an user-defined observer strategy.
Definition fwd.hpp:56
observer< Type, details::observers::lambda_strategy< Type, OnNext, OnError, OnCompleted > > lambda_observer
Observer specialized with passed callbacks. Most easiesest way to construct observer "on the fly" via...
Definition fwd.hpp:119
auto make_lambda_observer(OnNext &&on_next, OnError &&on_error={}, OnCompleted &&on_completed={}) -> lambda_observer< Type, std::decay_t< OnNext >, std::decay_t< OnError >, std::decay_t< OnCompleted > >
Constructs observer specialized with passed callbacks. Most easiesest way to construct observer "on t...
Definition lambda_observer.hpp:51
Definition lambda_observer.hpp:24
Definition functors.hpp:28
Definition functors.hpp:54