12#include <rpp/defs.hpp>
13#include <rpp/disposables/composite_disposable.hpp>
14#include <rpp/observers/observer.hpp>
15#include <rpp/utils/function_traits.hpp>
17namespace rpp::details::observers
20 std::invocable<Type> OnNext,
21 std::invocable<const std::exception_ptr&> OnError,
22 std::invocable<> OnCompleted>
25 static constexpr auto preferred_disposables_mode = rpp::details::observers::disposables_mode::Auto;
27 template<rpp::constra
int::decayed_same_as<OnNext> TOnNext, rpp::constra
int::decayed_same_as<OnError> TOnError, rpp::constra
int::decayed_same_as<OnCompleted> TOnCompleted>
28 explicit lambda_strategy(TOnNext&& on_next, TOnError&& on_error, TOnCompleted&& on_completed)
29 : on_next{std::forward<TOnNext>(on_next)}
30 , on_error{std::forward<TOnError>(on_error)}
31 , on_completed{std::forward<TOnCompleted>(on_completed)}
35 RPP_NO_UNIQUE_ADDRESS OnNext on_next{};
36 RPP_NO_UNIQUE_ADDRESS OnError on_error{};
37 RPP_NO_UNIQUE_ADDRESS OnCompleted on_completed{};
41 static bool is_disposed()
noexcept {
return false; }
48 std::invocable<Type> OnNext,
49 std::invocable<const std::exception_ptr&> OnError,
50 std::invocable<> OnCompleted>
55 std::decay_t<OnError>,
56 std::decay_t<OnCompleted>>
60 std::decay_t<OnError>,
61 std::decay_t<OnCompleted>>{
62 std::forward<OnNext>(on_next),
63 std::forward<OnError>(on_error),
64 std::forward<OnCompleted>(on_completed)};
67 template<constraint::decayed_type Type,
68 std::invocable<Type> OnNext,
69 std::invocable<const std::exception_ptr&> OnError,
70 std::invocable<> OnCompleted>
76 std::decay_t<OnError>,
77 std::decay_t<OnCompleted>>
81 std::decay_t<OnError>,
82 std::decay_t<OnCompleted>>{
84 std::forward<OnNext>(on_next),
85 std::forward<OnError>(on_error),
86 std::forward<OnCompleted>(on_completed)};
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:22
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