D++ (DPP)
C++ Discord API Bot Library
|
A task's promise_t type, with special logic for handling nested tasks. More...
#include <task.h>
Public Member Functions | |
~promise_t () | |
Destructor. Destroys the value if it was constructed. More... | |
void | return_value (R &&expr) noexcept(std::is_nothrow_move_constructible_v< R >) |
Function called by the standard library when the coroutine co_returns a value. More... | |
void | return_value (const R &expr) noexcept(std::is_nothrow_copy_constructible_v< R >) |
Function called by the standard library when the coroutine co_returns a value. More... | |
template<typename T > requires (!std::is_same_v<R, std::remove_cvref_t<T>> && std::convertible_to<T, R>) | |
void | return_value (T &&expr) noexcept(std::is_nothrow_convertible_v< T, R >) |
Function called by the standard library when the coroutine co_returns a value. More... | |
dpp::task< R > | get_return_object () noexcept |
Function called by the standard library when the coroutine is created. More... | |
final_awaiter< R > | final_suspend () const noexcept |
Function called by the standard library when the coroutine reaches its last suspension point. More... | |
std_coroutine::suspend_never | initial_suspend () const noexcept |
Function called by the standard library when the coroutine is created. More... | |
void | unhandled_exception () |
Function called by the standard library when an exception is thrown and not caught in the coroutine. More... | |
template<typename T > | |
auto | await_transform (T &&expr) const noexcept(noexcept(co_await_resolve(std::forward< T >(expr)))) |
Function called whenever co_await is used inside of the task. More... | |
Public Attributes | |
std::array< std::byte, sizeof(R)> | result_storage |
Stored return value of the coroutine. More... | |
std::atomic< state_t > | state = state_t::started |
State of the task, used to keep track of lifetime and status. More... | |
std::atomic< bool > | cancelled = false |
Whether the task is cancelled or not. More... | |
detail::std_coroutine::coroutine_handle | parent = nullptr |
Parent coroutine to return to for nested coroutines. More... | |
A task's promise_t type, with special logic for handling nested tasks.
Implementation of task::promise_t for non-void return type.
R | Return type of the task |
|
inline |
Destructor. Destroys the value if it was constructed.
|
inlinenoexceptinherited |
Function called whenever co_await is used inside of the task.
dpp::task_cancelled_exception | On resumption if the task was cancelled |
|
inlinenoexcept |
Function called by the standard library when the coroutine reaches its last suspension point.
|
inlinenoexcept |
Function called by the standard library when the coroutine is created.
|
inlinenoexceptinherited |
Function called by the standard library when the coroutine is created.
|
inlinenoexcept |
Function called by the standard library when the coroutine co_returns a value.
Stores the value internally to hand to the caller when it resumes.
expr | The value given to co_return |
|
inlinenoexcept |
Function called by the standard library when the coroutine co_returns a value.
Stores the value internally to hand to the caller when it resumes.
expr | The value given to co_return |
|
inlinenoexcept |
Function called by the standard library when the coroutine co_returns a value.
Stores the value internally to hand to the caller when it resumes.
expr | The value given to co_return |
|
inlineinherited |
Function called by the standard library when an exception is thrown and not caught in the coroutine.
Stores the exception pointer to rethrow on co_await. If the task object is destroyed and was not cancelled, throw instead
|
inherited |
Whether the task is cancelled or not.
|
inherited |
Parent coroutine to return to for nested coroutines.
std::array<std::byte, sizeof(R)> dpp::detail::task::promise_t< R >::result_storage |
Stored return value of the coroutine.
|
inherited |
State of the task, used to keep track of lifetime and status.