15void Start(BaseCore*
head, IExecutor&
e)
noexcept;
24template <
typename V,
typename T>
29 static_assert(
Check<V>(),
"V should be valid");
32 static_assert(!std::is_same_v<V, typename T::Error>,
33 "V cannot be the same as the trait Error type, because callback dispatch would be ambiguous");
49 return _core !=
nullptr;
59 return !_core->Empty();
68 return {std::move(this->_core)};
71 template <
typename Func>
74 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Call | CoreType::Lazy;
75 return detail::SetCallback<CoreT, false>(_core, &
e, std::forward<Func>(
f));
77 template <
typename Func>
80 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Lazy;
81 return detail::SetCallback<CoreT, false>(_core,
nullptr, std::forward<Func>(
f));
83 template <
typename Func>
86 static constexpr auto CoreT = CoreType::ToUnique | CoreType::Call | CoreType::Lazy;
87 return detail::SetCallback<CoreT, false>(_core,
nullptr, std::forward<Func>(
f));
96 auto* core = _core.Release();
102 auto* core = _core.Release();
110 return {std::move(_core)};
115 return {std::move(_core)};
120 return std::move(*this).ToFuture().Get();
132 auto core = std::exchange(_core,
nullptr);
133 return std::move(core->Get());
148 detail::UniqueCorePtr<V, T> _core;
151extern template class Task<>;
Provides a mechanism to access the result of async operations.
Provides a mechanism to access the result of async operations.
A intrusive pointer to objects with an embedded reference count.
Provides a mechanism to schedule the some async operations TODO(MBkkt) add description.
Task & operator=(const Task &)=delete
detail::UniqueCorePtr< V, T > & GetCore() noexcept
Method that get internal Core state.
Future< V, T > ToFuture() &&noexcept
void Detach(IExecutor &e) &&noexcept
Task & operator=(Task &&other) noexcept=default
auto Then(IExecutor &e, Func &&f) &&
bool Ready() const &noexcept
Check that Result that corresponds to this Task is computed.
void Touch() const &&=delete
Task(detail::UniqueCorePtr< V, T > core) noexcept
bool Valid() const &noexcept
typename T::template Result< V > Result
Task(Task &&other) noexcept=default
Task< V, T > On(std::nullptr_t) &&noexcept
Do nothing, just for compatibility with FutureOn TODO(MBkkt) think about force On/Detach/ToFuture: It...
Task(const Task &)=delete
auto ThenInline(Func &&f) &&
FutureOn< V, T > ToFuture(IExecutor &e) &&noexcept
Result Touch() &&noexcept
#define YACLIB_ASSERT(cond)
InlineCore & MakeDrop() noexcept
void Start(BaseCore *head, IExecutor &e) noexcept
Contract< V, T > MakeContract()
Creates related future and promise.
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.