ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
fwd.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2023 - present.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// https://www.boost.org/LICENSE_1_0.txt)
7//
8// Project home: https://github.com/victimsnino/ReactivePlusPlus
9//
10
11#pragma once
12
13#include <rpp/observables/fwd.hpp>
14#include <rpp/observers/fwd.hpp>
15#include <rpp/schedulers/fwd.hpp>
16
17#include <rpp/memory_model.hpp>
18#include <rpp/utils/constraints.hpp>
19#include <rpp/utils/function_traits.hpp>
20#include <rpp/utils/utils.hpp>
21
22#include <exception>
23
24namespace rpp::constraint
25{
26 template<typename S, typename T>
27 concept on_subscribe = requires(const S& strategy, rpp::details::observers::fake_observer<T>&& observer) {
28 {
29 strategy(std::move(observer))
30 } -> std::same_as<void>;
31 };
32} // namespace rpp::constraint
33
34namespace rpp::source
35{
36 template<constraint::decayed_type Type, constraint::on_subscribe<Type> OnSubscribe>
37 auto create(OnSubscribe&& on_subscribe);
38
39 template<utils::is_not_template_callable OnSubscribe, constraint::decayed_type Type = rpp::utils::extract_observer_type_t<rpp::utils::decayed_function_argument_t<OnSubscribe>>>
40 auto create(OnSubscribe&& on_subscribe);
41
42 template<constraint::memory_model MemoryModel = memory_model::use_stack, constraint::iterable Iterable, schedulers::constraint::scheduler TScheduler = rpp::schedulers::defaults::iteration_scheduler>
43 auto from_iterable(Iterable&& iterable, const TScheduler& scheduler = TScheduler{});
44
45 template<constraint::memory_model MemoryModel = memory_model::use_stack, typename T, typename... Ts>
46 requires (constraint::decayed_same_as<T, Ts> && ...)
47 auto just(T&& item, Ts&&... items);
48
49 template<constraint::memory_model MemoryModel = memory_model::use_stack, schedulers::constraint::scheduler TScheduler, typename T, typename... Ts>
50 requires (constraint::decayed_same_as<T, Ts> && ...)
51 auto just(const TScheduler& scheduler, T&& item, Ts&&... items);
52
53 template<constraint::memory_model MemoryModel = memory_model::use_stack, std::invocable<> Callable>
54 auto from_callable(Callable&& callable);
55
56 template<constraint::memory_model MemoryModel = memory_model::use_stack, rpp::constraint::observable TObservable, rpp::constraint::observable... TObservables>
57 requires (std::same_as<rpp::utils::extract_observable_type_t<TObservable>, rpp::utils::extract_observable_type_t<TObservables>> && ...)
58 auto concat(TObservable&& obs, TObservables&&... others);
59
60 template<constraint::memory_model MemoryModel = memory_model::use_stack, constraint::iterable Iterable>
61 requires constraint::observable<utils::iterable_value_t<Iterable>>
62 auto concat(Iterable&& iterable);
63
64 template<std::invocable Factory>
66 auto defer(Factory&& observable_factory);
67
68 template<constraint::decayed_type Type>
69 auto error(std::exception_ptr err);
70
71 template<constraint::decayed_type Type>
72 auto empty();
73
74 template<schedulers::constraint::scheduler TScheduler>
75 auto interval(rpp::schedulers::duration initial, rpp::schedulers::duration period, TScheduler&& scheduler);
76
77 template<schedulers::constraint::scheduler TScheduler>
78 auto interval(rpp::schedulers::time_point initial, rpp::schedulers::duration period, TScheduler&& scheduler);
79
80 template<schedulers::constraint::scheduler TScheduler>
81 auto interval(rpp::schedulers::duration period, TScheduler&& scheduler);
82
83 template<constraint::decayed_type Type>
84 auto never();
85
86 template<schedulers::constraint::scheduler TScheduler>
87 auto timer(rpp::schedulers::duration when, TScheduler&& scheduler);
88
89 template<schedulers::constraint::scheduler TScheduler>
90 auto timer(rpp::schedulers::time_point when, TScheduler&& scheduler);
91} // namespace rpp::source
Base class for any observer used in RPP. It handles core callbacks of observers. Objects of this clas...
Definition observer.hpp:172
Definition fwd.hpp:80
Definition fwd.hpp:250
Definition fwd.hpp:27
auto never()
Creates rpp::observable that emits no items and does not terminate.
Definition never.hpp:46
auto just(const TScheduler &scheduler, T &&item, Ts &&... items)
Creates rpp::observable that emits a particular items and completes.
Definition from.hpp:201
auto interval(rpp::schedulers::duration initial, rpp::schedulers::duration period, TScheduler &&scheduler)
Creates rpp::observable that emits a sequential integer every specified time interval,...
Definition interval.hpp:72
auto error(std::exception_ptr err)
Creates rpp::observable that emits no items and terminates with an error.
Definition error.hpp:49
auto from_callable(Callable &&callable)
Creates rpp::specific_observable that calls provided callable and emits resulting value of this calla...
Definition from.hpp:249
auto concat(TObservable &&obs, TObservables &&... others)
Make observable which would merge emissions from underlying observables but without overlapping (curr...
Definition concat.hpp:171
auto from_iterable(Iterable &&iterable, const TScheduler &scheduler)
Creates observable that emits a items from provided iterable.
Definition from.hpp:175
auto empty()
Creates rpp::observable that emits no items but terminates normally.
Definition empty.hpp:48
auto defer(Factory &&observable_factory)
Creates rpp::observable that calls the specified observable factory to create an observable for each ...
Definition defer.hpp:57
auto create(OnSubscribe &&on_subscribe)
Construct observable specialized with passed callback function. Most easiesest way to construct obser...
Definition create.hpp:57
auto timer(rpp::schedulers::duration when, TScheduler &&scheduler)
Creates rpp::observable that emits an integer after a given delay, on the specified scheduler.
Definition timer.hpp:22