ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
constraints.hpp
1// ReactivePlusPlus library
2//
3// Copyright Aleksey Loginov 2022 - 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/schedulers/fwd.hpp>
14#include <rpp/subscriptions/fwd.hpp>
15
16#include <concepts>
17
18namespace rpp::schedulers::constraint
19{
20// returns std::nullopt in case of don't need to re-schedule schedulable or some duration which will be added to "now" and re-scheduled
21template<typename T>
22concept schedulable_fn = std::invocable<T> && std::same_as<std::invoke_result_t<T>, optional_duration>;
23
24template<typename T>
25concept inner_schedulable_fn = std::invocable<T> && std::same_as<std::invoke_result_t<T>, void>;
26
27template<typename T>
28concept worker = std::is_base_of_v<details::worker_tag, std::decay_t<T>>;
29
30template<typename T>
31concept scheduler = std::is_base_of_v<details::scheduler_tag, std::decay_t<T>> && requires(const T t)
32{
33 {t.create_worker(std::declval<rpp::composite_subscription>())} -> worker;
34};
35} // namespace rpp::schedulers::constraint
Definition: constraints.hpp:22
Definition: constraints.hpp:31
Definition: constraints.hpp:28