D++ (DPP)
C++ Discord API Bot Library
|
Generic awaitable class, represents a future value that can be co_await-ed on. More...
Classes | |
struct | awaiter |
Awaiter returned by co_await. More... | |
Public Member Functions | |
awaitable ()=default | |
Construct an empty awaitable. More... | |
awaitable (const awaitable &)=delete | |
Copy construction is disabled. More... | |
awaitable (awaitable &&rhs) noexcept | |
Move from another awaitable. More... | |
~awaitable () | |
Destructor. More... | |
awaitable & | operator= (const awaitable &)=delete |
Copy assignment is disabled. More... | |
awaitable & | operator= (awaitable &&rhs) noexcept |
Move from another awaitable. More... | |
bool | valid () const noexcept |
Check whether this awaitable refers to a valid promise. More... | |
bool | await_ready () const |
Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not. More... | |
template<typename Derived > | |
requires (std::is_base_of_v< awaitable, std::remove_cv_t< Derived >>) friend awaiter< Derived & > operator co_await(Derived &obj) noexcept | |
Overload of the co_await operator. More... | |
template<typename Derived > | |
requires (std::is_base_of_v< awaitable, std::remove_cv_t< Derived >>) friend awaiter< Derived && > operator co_await(Derived &&obj) noexcept | |
Overload of the co_await operator. Returns an awaiter referencing this awaitable. More... | |
Protected Types | |
using | shared_state = detail::promise::promise_base< T > |
using | state_flags = detail::promise::state_flags |
using | result_type = T |
The type of the result produced by this task. More... | |
Protected Member Functions | |
awaitable (shared_state *promise) noexcept | |
Construct from a promise. More... | |
uint8_t | abandon () |
Abandons the promise. More... | |
Protected Attributes | |
shared_state * | state_ptr = nullptr |
Non-owning pointer to the promise, which must be kept alive for the entire lifetime of the awaitable. More... | |
Friends | |
class | detail::promise::promise_base< T > |
Generic awaitable class, represents a future value that can be co_await-ed on.
Roughly equivalent of std::future for coroutines, with the crucial distinction that the future does not own a reference to a "shared state". It holds a non-owning reference to the promise, which must be kept alive for the entire lifetime of the awaitable.
T | Type of the asynchronous value |
|
protected |
The type of the result produced by this task.
|
protected |
|
protected |
|
inlineprotectednoexcept |
Construct from a promise.
promise | The promise to refer to. |
|
default |
Construct an empty awaitable.
Such an awaitable must be assigned a promise before it can be awaited.
|
delete |
Copy construction is disabled.
|
inlinenoexcept |
Move from another awaitable.
rhs | The awaitable to move from, left in an unspecified state after this. |
dpp::awaitable< T >::~awaitable |
Destructor.
May signal to the promise that it was destroyed.
|
protected |
Abandons the promise.
Set the promise's state to broken and unlinks this awaitable.
bool dpp::awaitable< T >::await_ready |
Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not.
|
inlinenoexcept |
Move from another awaitable.
rhs | The awaitable to move from, left in an unspecified state after this. |
|
delete |
Copy assignment is disabled.
|
inlinenoexcept |
Overload of the co_await operator.
|
inlinenoexcept |
|
noexcept |
Check whether this awaitable refers to a valid promise.
|
friend |
|
protected |
Non-owning pointer to the promise, which must be kept alive for the entire lifetime of the awaitable.