| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
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 >:
[legend]

## Public Member Functions

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

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

  Derived | Type 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 | ( |  | ) | const

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

Exceptions

  dpp::logic_exception | If 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_exception | If 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.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0