82struct AsyncCommandResultBase {
84 std::optional<::aria::Error> error{};
106 static_assert(!std::is_reference_v<R>,
107 "AsyncCommandResult<R&> is not supported. Use a value type or "
108 "wrap in std::reference_wrapper at the action layer.");
112 [[nodiscard]]
explicit operator bool() const noexcept {
return completed(); }
122 [[nodiscard]]
const R&&
operator*() const&& noexcept {
return std::move(*
value); }
132 return completed() ? *
value :
static_cast<R
>(std::forward<U>(fallback));
136 return completed() ? std::move(*
value)
137 :
static_cast<R
>(std::forward<U>(fallback));
147 r.
value.emplace(std::move(v));
158 r.error.emplace(std::move(e));
164 r.error.emplace(std::move(e));
173 [[nodiscard]]
explicit operator bool() const noexcept {
return completed(); }
188 r.error.emplace(std::move(e));
194 r.error.emplace(std::move(e));
Definition async_command.hpp:118
AsyncCommandStatus
Outcome category for a single AsyncCommand invocation.
Definition async_command_result.hpp:70
@ Completed
action finished, value (if any) produced
Definition async_command_result.hpp:71
@ Dropped
DropIfRunning rejected this invocation; never started.
Definition async_command_result.hpp:72
@ Cancelled
OperationCancelled observed before completion.
Definition async_command_result.hpp:73
@ Failed
action threw a non-cancellation exception
Definition async_command_result.hpp:74
One uniform error record.
Definition error.hpp:129
static AsyncCommandResult cancelled_(::aria::Error e)
Definition async_command_result.hpp:185
static AsyncCommandResult failed_(::aria::Error e)
Definition async_command_result.hpp:191
static AsyncCommandResult completed_with()
Definition async_command_result.hpp:175
static AsyncCommandResult dropped_()
Definition async_command_result.hpp:180
Result of AsyncCommand<R, Args...>::co_execute(...).
Definition async_command_result.hpp:105
const R && operator*() const &&noexcept
Definition async_command_result.hpp:122
const R & operator*() const &noexcept
Definition async_command_result.hpp:120
static AsyncCommandResult dropped_()
Definition async_command_result.hpp:150
static AsyncCommandResult failed_(::aria::Error e)
Definition async_command_result.hpp:161
R value_or(U &&fallback) const &
Convenience: extract value or fall back.
Definition async_command_result.hpp:131
R * operator->() noexcept
Definition async_command_result.hpp:124
const R * operator->() const noexcept
Definition async_command_result.hpp:125
R value_or(U &&fallback) &&
Definition async_command_result.hpp:135
R && operator*() &&noexcept
Definition async_command_result.hpp:121
static AsyncCommandResult cancelled_(::aria::Error e)
Definition async_command_result.hpp:155
R & operator*() &noexcept
Direct access to the produced value.
Definition async_command_result.hpp:119
std::optional< R > value
Definition async_command_result.hpp:110
static AsyncCommandResult completed_with(R v)
Definition async_command_result.hpp:144