D++ (DPP)
C++ Discord API Bot Library
|
Public Member Functions | |
template<bool Notify = true> | |
void | set_value () |
Set the promise to completed, and resume any awaiter. More... | |
promise_base ()=default | |
Construct a new promise, with empty result. More... | |
promise_base (const promise_base &)=delete | |
Copy construction is disabled. More... | |
promise_base (promise_base &&rhs)=delete | |
Move construction is disabled. More... | |
promise_base & | operator= (const promise_base &)=delete |
Copy assignment is disabled. More... | |
promise_base & | operator= (promise_base &&rhs)=delete |
Move assignment is disabled. More... | |
template<bool Notify = true> | |
void | set_exception (std::exception_ptr ptr) |
Set this promise to an exception and resume any awaiter. More... | |
void | notify_awaiter () |
Notify a currently awaiting coroutine that the result is ready. More... | |
awaitable< T > | get_awaitable () |
Get an awaitable object for this promise. More... | |
Protected Types | |
using | storage_type = std::variant< std::monostate, std::conditional_t< std::is_void_v< T >, empty, T >, std::exception_ptr > |
Variant representing one of either 3 states of the result value : empty, result, exception. More... | |
Protected Member Functions | |
void | throw_if_not_empty () |
Check if the result is empty, throws otherwise. More... | |
std_coroutine::coroutine_handle | release_awaiter () |
Protected Attributes | |
storage_type | value = std::monostate{} |
State of the result value. More... | |
std::atomic< uint8_t > | state = sf_none |
State of the awaitable tied to this promise. More... | |
std_coroutine::coroutine_handle | awaiter = nullptr |
Coroutine handle currently awaiting the completion of this promise. More... | |
|
protectedinherited |
Variant representing one of either 3 states of the result value : empty, result, exception.
|
inlineinherited |
Get an awaitable object for this promise.
dpp::logic_exception | if get_awaitable has already been called on this object. |
|
inlineinherited |
Notify a currently awaiting coroutine that the result is ready.
|
delete |
Copy assignment is disabled.
|
delete |
Move assignment is disabled.
|
default |
Construct a new promise, with empty result.
|
delete |
Copy construction is disabled.
|
delete |
Move construction is disabled.
|
inlineprotectedinherited |
|
inlineinherited |
Set this promise to an exception and resume any awaiter.
Notify | Whether to resume any awaiter or not. |
dpp::logic_exception | if the promise is not empty. |
|
inline |
Set the promise to completed, and resume any awaiter.
dpp::logic_exception | if the promise is not empty. |
|
inlineprotectedinherited |
Check if the result is empty, throws otherwise.
dpp::logic_exception | if the result isn't empty. |
|
protectedinherited |
Coroutine handle currently awaiting the completion of this promise.
|
protectedinherited |
State of the awaitable tied to this promise.
|
protectedinherited |
State of the result value.