14template <
typename V = Unit,
typename E = StopError,
typename Func>
17 if constexpr (std::is_same_v<V, Unit>) {
27 using ResultCoreT =
typename std::remove_reference_t<
decltype(*core)>::Base;
31template <
typename V = Unit,
typename E = StopError,
typename Func>
34 if constexpr (std::is_same_v<V, Unit>) {
44 using ResultCoreT =
typename std::remove_reference_t<
decltype(*core)>::Base;
56template <
typename E = StopError,
typename Func>
58 return detail::Run<Unit, E>(
MakeInline(), std::forward<Func>(
f)).On(
nullptr);
61template <
typename E = StopError,
typename Func>
63 return detail::RunShared<Unit, E>(
MakeInline(), std::forward<Func>(
f));
73template <
typename E = StopError,
typename Func>
76 "better way is call func explicit and use MakeFuture to create Future with func result"
77 " or at least use Run(func)");
78 return detail::Run<Unit, E>(
e, std::forward<Func>(
f));
81template <
typename E = StopError,
typename Func>
83 return detail::RunShared<Unit, E>(
e, std::forward<Func>(
f));
92template <
typename V =
void,
typename E = StopError,
typename Func>
94 return detail::Run<V, E>(
MakeInline(), std::forward<Func>(
f)).On(
nullptr);
97template <
typename V =
void,
typename E = StopError,
typename Func>
99 return detail::RunShared<V, E>(
MakeInline(), std::forward<Func>(
f));
109template <
typename V =
void,
typename E = StopError,
typename Func>
112 "better way is call func explicit and use MakeFuture to create Future with func result"
113 " or at least use AsyncContract(func)");
114 return detail::Run<V, E>(
e, std::forward<Func>(
f));
117template <
typename V =
void,
typename E = StopError,
typename Func>
119 return detail::RunShared<V, E>(
e, std::forward<Func>(
f));
Provides a mechanism to access the result of async operations.
A intrusive pointer to objects with an embedded reference count.
#define YACLIB_WARN(cond, message)
constexpr size_t kSharedRefWithFuture
std::conditional_t< IsDetach(Type), NoResultCore, std::conditional_t< IsToShared(Type), SharedCore< V, E >, UniqueCore< V, E > > > ResultCoreT
YACLIB_INLINE auto RunShared(IExecutor &e, Func &&f)
auto AsyncSharedContract(Func &&f)
auto Run(Func &&f)
Execute Callable func on Inline executor.
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.
Contract< V, E > MakeContract()
Creates related future and promise.
auto AsyncContract(Func &&f)
Execute Callable func on Inline executor.