12#include <rpp/observers/state_observer.hpp>
13#include <rpp/observers/dynamic_observer.hpp>
14#include <rpp/subscriptions/composite_subscription.hpp>
15#include <rpp/subscribers/specific_subscriber.hpp>
19template<constraint::decayed_type Type,
21 std::invocable<Type, std::decay_t<States>...> OnNext,
22 std::invocable<std::exception_ptr, std::decay_t<States>...> OnError,
23 std::invocable<std::decay_t<States>...> OnCompleted>
24auto create_subscriber_with_state(composite_subscription sub,
27 OnCompleted&& on_completed,
30 using TObs = state_observer<Type,
32 std::decay_t<OnError>,
33 std::decay_t<OnCompleted>,
34 std::decay_t<States>...>;
35 return make_specific_subscriber<Type, TObs>(std::move(sub),
36 std::forward<OnNext>(on_next),
37 std::forward<OnError>(on_error),
38 std::forward<OnCompleted>(on_completed),
39 std::forward<States>(states)...);
42template<constraint::decayed_type Type,
44 std::invocable<Type, std::decay_t<States>...> OnNext,
45 std::invocable<std::exception_ptr, std::decay_t<States>...> OnError,
46 std::invocable<std::decay_t<States>...> OnCompleted>
47auto create_subscriber_with_dynamic_state(composite_subscription sub,
50 OnCompleted&& on_completed,
53 using TObs = dynamic_state_observer<Type, std::decay_t<States>...>;
54 return make_specific_subscriber<Type, TObs>(std::move(sub),
55 std::forward<OnNext>(on_next),
56 std::forward<OnError>(on_error),
57 std::forward<OnCompleted>(on_completed),
58 std::forward<States>(states)...);