D++ (DPP)
C++ Discord API Bot Library
|
A coroutine task. It starts immediately on construction and can be co_await-ed, making it perfect for parallel coroutines returning a value. More...
Public Member Functions | |
task ()=default | |
Default constructor, creates a task not bound to a coroutine. More... | |
task (const task &)=delete | |
Copy constructor is disabled. More... | |
task (task &&other) noexcept | |
Move constructor, grabs another task's coroutine handle. More... | |
task & | operator= (const task &)=delete |
Copy assignment is disabled. More... | |
task & | operator= (task &&other) noexcept |
Move assignment, grabs another task's coroutine handle. More... | |
~task () | |
Destructor. More... | |
bool | done () const noexcept |
Function to check if the task has finished its execution entirely. More... | |
task & | cancel () &noexcept |
Cancel the task, it will stop the next time it uses co_await. On co_await-ing this task, throws dpp::task_cancelled_exception. More... | |
task && | cancel () &&noexcept |
Cancel the task, it will stop the next time it uses co_await. On co_await-ing this task, throws dpp::task_cancelled_exception. More... | |
Protected Member Functions | |
task (handle_t handle_) | |
Construct from a coroutine handle. Internal use only. More... | |
void | cleanup () |
Clean up our handle, cancelling any running task. More... | |
Friends | |
struct | detail::task::promise_t< R > |
A coroutine task. It starts immediately on construction and can be co_await-ed, making it perfect for parallel coroutines returning a value.
R | Return type of the task. Cannot be a reference but can be void. |
|
inlineexplicitprotected |
Construct from a coroutine handle. Internal use only.
|
default |
Default constructor, creates a task not bound to a coroutine.
|
delete |
Copy constructor is disabled.
|
inlinenoexcept |
Move constructor, grabs another task's coroutine handle.
other | Task to move the handle from |
|
inline |
Destructor.
Destroys the handle. If the task is still running, it will be cancelled.
|
inlinenoexcept |
Cancel the task, it will stop the next time it uses co_await. On co_await-ing this task, throws dpp::task_cancelled_exception.
|
inlinenoexcept |
Cancel the task, it will stop the next time it uses co_await. On co_await-ing this task, throws dpp::task_cancelled_exception.
|
inlineprotected |
Clean up our handle, cancelling any running task.
|
inlinenoexcept |
Function to check if the task has finished its execution entirely.
Move assignment, grabs another task's coroutine handle.
other | Task to move the handle from |
|
friend |