D++ (DPP)
C++ Discord API Bot Library
dpp::awaitable< T >::awaiter< Derived > Struct Template Reference

Awaiter returned by co_await. More...

#include <awaitable.h>

+ Collaboration diagram for dpp::awaitable< T >::awaiter< Derived >:

Public Member Functions

bool await_ready () const
 First function called by the standard library when co_await-ing this object. More...
 
bool await_suspend (detail::std_coroutine::coroutine_handle<> handle)
 Second function called by the standard library when co_await-ing this object. More...
 
await_resume ()
 Third and final function called by the standard library when co_await-ing this object, after resuming. More...
 

Public Attributes

Derived awaitable_obj
 

Detailed Description

template<typename T>
template<typename Derived>
struct dpp::awaitable< T >::awaiter< Derived >

Awaiter returned by co_await.

Contains the await_ready, await_suspend and await_resume functions required by the C++ standard. This class is CRTP-like, in that it will refer to an object derived from awaitable.

Template Parameters
DerivedType of reference to refer to the awaitable.

Member Function Documentation

◆ await_ready()

template<typename T >
template<typename Derived >
bool dpp::awaitable< T >::awaiter< Derived >::await_ready

First function called by the standard library when co_await-ing this object.

Exceptions
dpp::logic_exceptionIf the awaitable's valid() would return false.
Returns
bool Whether the result is ready, in which case we don't need to suspend

◆ await_resume()

template<typename T >
template<typename Derived >
T dpp::awaitable< T >::awaiter< Derived >::await_resume

Third and final function called by the standard library when co_await-ing this object, after resuming.

Exceptions
?Any exception that occured during the retrieval of the value will be thrown
Returns
T The result.

◆ await_suspend()

template<typename T >
template<typename Derived >
bool dpp::awaitable< T >::awaiter< Derived >::await_suspend ( detail::std_coroutine::coroutine_handle<>  handle)

Second function called by the standard library when co_await-ing this object.

Exceptions
dpp::logic_exceptionIf the awaitable's valid() would return false. At this point the coroutine frame was allocated and suspended.
Returns
bool Whether we do need to suspend or not

Member Data Documentation

◆ awaitable_obj

template<typename T >
template<typename Derived >
Derived dpp::awaitable< T >::awaiter< Derived >::awaitable_obj
D++ 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