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

Awaiter returned by co_await. More...

+ 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 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