71 [[nodiscard]]
constexpr bool ok() const noexcept {
76 [[nodiscard]]
constexpr explicit operator bool() const noexcept {
97 static_assert(!std::is_reference_v<T>,
98 "yorch::task_result<T> does not support reference types");
99 static_assert(!std::is_void_v<T>,
100 "yorch::task_result<void> is not supported; use `void` for success-only tasks or `yorch::step_result` for status-only tasks");
116 template <
typename U>
118 noexcept(std::is_nothrow_constructible_v<T, U&&>) {
140 "yorch::task_result<T>::from_step(...) requires a non-success status");
144 [[nodiscard]]
constexpr bool has_value() const noexcept {
145 return value_.has_value();
148 [[nodiscard]]
constexpr T&
value() &
noexcept {
152 [[nodiscard]]
constexpr const T&
value() const& noexcept {
156 [[nodiscard]]
constexpr T&&
value() &&
noexcept {
157 return std::move(value_).get();
164 template <
typename U>
166 noexcept(std::is_nothrow_constructible_v<T, U&&>)
168 value_.emplace(std::forward<U>(
value));
#define YORCH_ASSERT(condition)
constexpr bool is_adapter_descriptor_v
constexpr bool is_task_result_v
constexpr auto value(T &&v) -> value_t< std::remove_cvref_t< T > >
Wraps a value as an owning spec.
typename task_result_value< std::remove_cvref_t< T > >::type task_result_value_t
step_status
Describes the execution status of a single step.
Type trait that detects task_result<T>.
Represents the basic outcome of a task step.
static constexpr step_result failure() noexcept
Creates a failed result.
static constexpr step_result retry() noexcept
Creates a retry result.
constexpr bool ok() const noexcept
Returns whether the status is success.
static constexpr step_result abort_execution() noexcept
Creates a result that aborts the whole execution.
static constexpr step_result abort_branch() noexcept
Creates a result that aborts the current branch.
static constexpr step_result success() noexcept
Creates a successful result.
Extracts the payload type from a supported task_result<T>.
Represents a step result that may carry a produced value.
static constexpr task_result failure() noexcept
step_result step
Execution status of the current step.
constexpr const T & value() const &noexcept
constexpr T && value() &&noexcept
constexpr T & value() &noexcept
T value_type
Value type carried by this result wrapper.
static constexpr task_result success(U &&value) noexcept(std::is_nothrow_constructible_v< T, U && >)
task_result & operator=(const task_result &)=default
static constexpr task_result retry() noexcept
static constexpr task_result abort_branch() noexcept
constexpr bool has_value() const noexcept
task_result(task_result &&)=default
task_result & operator=(task_result &&)=default
task_result(const task_result &)=default
static constexpr task_result from_step(step_result s) noexcept
static constexpr task_result abort_execution() noexcept