D++ (DPP)
C++ Discord API Bot Library
dpp::promise Struct Reference

Implementation of promise_type for dpp's coroutines. More...

#include <coro.h>

+ Collaboration diagram for dpp::promise:

Public Member Functions

 promise ()=default
 Construct a new promise object. More...
 
 promise (const dpp::event_dispatch_t &ev)
 Construct a new promise object. More...
 
task get_return_object ()
 Get the return object. More...
 
std::suspend_never initial_suspend () noexcept
 Function called when the coroutine is first suspended, never suspends. More...
 
std::suspend_never final_suspend () noexcept
 Function called when the coroutine reaches its last suspension point. More...
 
void return_void () noexcept
 Function called when the coroutine returns nothing. More...
 
void unhandled_exception ()
 Function called when coroutine throws a un-catch-ed exception. Does nothing. More...
 

Public Attributes

clusterbot = nullptr
 A pointer to the cluster making the requests in the coroutine. More...
 
confirmation_callback_t callback
 The result of the last co_await-ed function. More...
 

Detailed Description

Implementation of promise_type for dpp's coroutines.

Constructor & Destructor Documentation

◆ promise() [1/2]

dpp::promise::promise ( )
default

Construct a new promise object.

◆ promise() [2/2]

dpp::promise::promise ( const dpp::event_dispatch_t ev)
inline

Construct a new promise object.

Parameters
evBase type of all events, only used to get the dpp::cluster pointer

Member Function Documentation

◆ final_suspend()

std::suspend_never dpp::promise::final_suspend ( )
inlinenoexcept

Function called when the coroutine reaches its last suspension point.

Returns
std::suspend_never Never suspend this coroutine at the final suspend point

◆ get_return_object()

task dpp::promise::get_return_object ( )
inline

Get the return object.

Returns
task dpp::task type

◆ initial_suspend()

std::suspend_never dpp::promise::initial_suspend ( )
inlinenoexcept

Function called when the coroutine is first suspended, never suspends.

Returns
std::suspend_never Never suspend this coroutine at the first suspend point

◆ return_void()

void dpp::promise::return_void ( )
inlinenoexcept

Function called when the coroutine returns nothing.

◆ unhandled_exception()

void dpp::promise::unhandled_exception ( )
inline

Function called when coroutine throws a un-catch-ed exception. Does nothing.

Member Data Documentation

◆ bot

cluster* dpp::promise::bot = nullptr

A pointer to the cluster making the requests in the coroutine.

◆ callback

confirmation_callback_t dpp::promise::callback

The result of the last co_await-ed function.

D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0