15void Start(BaseCore*
head, IExecutor&
e)
noexcept;
24template <
typename V,
typename E>
27 static_assert(
Check<V>(),
"V should be valid");
28 static_assert(
Check<E>(),
"E should be valid");
29 static_assert(!std::is_same_v<V, E>,
"Task cannot be instantiated with same V and E, because it's ambiguous");
45 return _core !=
nullptr;
55 return !_core->Empty();
64 return {std::move(this->_core)};
67 template <
typename Func>
69 return detail::SetCallback<detail::CoreType::Then, detail::CallbackType::LazyOn>(_core, &
e, std::forward<Func>(
f));
71 template <
typename Func>
73 return detail::SetCallback<detail::CoreType::Then, detail::CallbackType::LazyInline>(_core,
nullptr,
74 std::forward<Func>(
f));
76 template <
typename Func>
78 return detail::SetCallback<detail::CoreType::Then, detail::CallbackType::LazyOn>(_core,
nullptr,
79 std::forward<Func>(
f));
88 auto*
core = _core.Release();
94 auto*
core = _core.Release();
101 return {std::move(_core)};
105 return {std::move(_core)};
110 return std::move(*this).ToFuture().Get();
122 auto core = std::exchange(_core,
nullptr);
123 return std::move(
core->Get());
138 detail::ResultCorePtr<V, E> _core;
141extern 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.
Encapsulated return value from caller.
Provides a mechanism to schedule the some async operations TODO(MBkkt) add description.
Task & operator=(const Task &)=delete
detail::ResultCorePtr< V, E > & GetCore() noexcept
Method that get internal Core state.
Result< V, E > Touch() &&noexcept
auto ThenInline(Func &&f) &&
bool Ready() const &noexcept
Check that Result that corresponds to this Task is computed.
void Touch() const &&=delete
Task< V, E > On(std::nullptr_t) &&noexcept
Do nothing, just for compatibility with FutureOn TODO(MBkkt) think about force On/Detach/ToFuture: It...
Task(Task &&other) noexcept=default
void Detach(IExecutor &e) &&noexcept
bool Valid() const &noexcept
Future< V, E > ToFuture() &&noexcept
Result< V, E > Get() &&noexcept
auto Then(IExecutor &e, Func &&f) &&
Task(const Task &)=delete
FutureOn< V, E > ToFuture(IExecutor &e) &&noexcept
Task & operator=(Task &&other) noexcept=default
Task(detail::ResultCorePtr< V, E > core) noexcept
#define YACLIB_ASSERT(cond)
InlineCore & MakeDrop() noexcept
void Start(BaseCore *head, IExecutor &e) noexcept
IExecutor & MakeInline() noexcept
Get Inline executor singleton object.
Contract< V, E > MakeContract()
Creates related future and promise.