D++ (DPP)
C++ Discord API Bot Library
|
A co_await-able object handling an API call in parallel with the caller. More...
Public Types | |
using | result_type = R |
The return type of the API call. Defaults to confirmation_callback_t. More... | |
Public Member Functions | |
template<typename Obj , typename Fun , typename... Args> | |
async (Obj &&obj, Fun &&fun, Args &&... args) | |
Construct an async object wrapping an object method, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result. More... | |
template<typename Fun , typename... Args> | |
async (Fun &&fun, Args &&... args) | |
Construct an async object wrapping an invokeable object, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result. More... | |
async (const async &)=delete | |
async (async &&)=default | |
async & | operator= (const async &)=delete |
async & | operator= (async &&)=default |
~async () | |
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... | |
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... | |
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< R > |
using | state_flags = detail::promise::state_flags |
Protected Member Functions | |
uint8_t | abandon () |
Abandons the promise. More... | |
Protected Attributes | |
shared_state * | state_ptr |
Non-owning pointer to the promise, which must be kept alive for the entire lifetime of the awaitable. More... | |
A co_await-able object handling an API call in parallel with the caller.
This class is the return type of the dpp::cluster::co_* methods, but it can also be created manually to wrap any async call.
R | The return type of the API call. Defaults to confirmation_callback_t |
using dpp::async< R >::result_type = R |
The return type of the API call. Defaults to confirmation_callback_t.
|
protectedinherited |
|
protectedinherited |
|
inlineexplicit |
Construct an async object wrapping an object method, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.
obj | The object to call the method on |
fun | The method of the object to call. Its last parameter must be a callback taking a parameter of type R |
args | Parameters to pass to the method, excluding the callback |
|
inlineexplicit |
Construct an async object wrapping an invokeable object, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.
fun | The object to call using std::invoke. Its last parameter must be a callable taking a parameter of type R |
args | Parameters to pass to the object, excluding the callback |
|
delete |
|
default |
|
inline |
|
protectedinherited |
Abandons the promise.
Set the promise's state to broken and unlinks this awaitable.
|
inherited |
Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not.
|
default |
|
delete |
|
inlinenoexceptinherited |
Overload of the co_await operator.
|
inlinenoexceptinherited |
Overload of the co_await operator. Returns an awaiter referencing this awaitable.
|
noexceptinherited |
Check whether this awaitable refers to a valid promise.
|
protectedinherited |
Non-owning pointer to the promise, which must be kept alive for the entire lifetime of the awaitable.