D++ (DPP)
C++ Discord API Bot Library
|
A co_await-able struct which returns the result of stored api call when co_await-ed. Meant to be opaque to the user. More...
#include <coro.h>
Public Member Functions | |
awaitable (cluster *cl, T api_call) | |
Construct a new awaitable object. More... | |
bool | await_ready () noexcept |
First function called when this object is co_await-ed, its return type tells if the coroutine should be immediately suspended. More... | |
void | await_suspend (handle_type handle) |
Function called when the coroutine is suspended, makes the api request and queues the resumption of the suspended coroutine, storing the result in promise object. More... | |
confirmation_callback_t | await_resume () |
Function called when the coroutine is resumed by its handle, handles the retrieval and return of result from promise object. More... | |
Public Attributes | |
promise * | p |
Pointer to the nested promise object of the coroutine, used for storing and retrieving the result of an api call. More... | |
cluster * | bot |
Pointer to the cluster making the api request. More... | |
T | api_req |
The function handling the making of request, using the cluster pointer. More... | |
A co_await-able struct which returns the result of stored api call when co_await-ed. Meant to be opaque to the user.
T | The type of the function (lambda if auto-generated by the php script) handling the making of api call |
|
inline |
Construct a new awaitable object.
cl | pointer to the cluster making the api request |
api_call | a function to invoke with the cluster pointer, handles the making of request |
|
inlinenoexcept |
First function called when this object is co_await-ed, its return type tells if the coroutine should be immediately suspended.
|
inline |
Function called when the coroutine is resumed by its handle, handles the retrieval and return of result from promise object.
|
inline |
Function called when the coroutine is suspended, makes the api request and queues the resumption of the suspended coroutine, storing the result in promise object.
handle | the handle to the suspended coroutine |
T dpp::awaitable< T >::api_req |
The function handling the making of request, using the cluster pointer.
cluster* dpp::awaitable< T >::bot |
Pointer to the cluster making the api request.
promise* dpp::awaitable< T >::p |
Pointer to the nested promise object of the coroutine, used for storing and retrieving the result of an api call.