10#include <userver/engine/exception.hpp>
11#include <userver/engine/impl/task_context_holder.hpp>
12#include <userver/engine/task/task.hpp>
13#include <userver/utils/fast_scope_guard.hpp>
14#include <userver/utils/impl/wrapped_call.hpp>
16USERVER_NAMESPACE_BEGIN
53 T
Get()
noexcept(
false) {
61 utils::FastScopeGuard invalidate([
this]()
noexcept { Invalidate(); });
62 return utils::impl::CastWrappedCall<T>(GetPayload()).Retrieve();
65 using Task::TryGetContextAccessor;
71 explicit TaskWithResult(
impl::TaskContextHolder&& context) :
Task(std::move(context)) {}
75 void EnsureValid()
const {
78 "TaskWithResult::Get was called on an invalid task. Note that "
79 "Get invalidates self, so it must be called at most once "