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

Search
Loading...
Searching...
No Matches
dpp::detail::coroutine::promise_t< void > Struct Reference

Struct returned by a coroutine's final_suspend, resumes the continuation. More...

`#include <coroutine.h>`

Inheritance diagram for dpp::detail::coroutine::promise_t< void >:
[legend]
Collaboration diagram for dpp::detail::coroutine::promise_t< void >:
[legend]

## Public Member Functions

final_awaiter< void > | final_suspend () const noexcept
| Function called by the standard library when reaching the end of a coroutine.
dpp::coroutine< void > | get_return_object ()
| Function called to get the coroutine object.
std_coroutine::suspend_always | initial_suspend () const noexcept
| Function called by the standard library when the coroutine start.
void | return_value (void &&expr) noexcept(std::is_nothrow_move_constructible_v< void >)
| Function called by the standard library when the coroutine co_returns a value.
void | return_void () const noexcept
| Function called when co_return is used.
void | unhandled_exception () noexcept
| Function called when an exception escapes the coroutine.

## Public Attributes

std::exception_ptr | exception {nullptr}
| Pointer to an uncaught exception thrown by the coroutine.
std_coroutine::coroutine_handle | parent {nullptr}
| Handle of the coroutine co_await-ing this coroutine.
std::optional< void > | result
| Return value of the coroutine.

## Detailed Description

Struct returned by a coroutine's final_suspend, resumes the continuation.

## Member Function Documentation

## ◆ final_suspend()

final_awaiter< void > dpp::detail::coroutine::promise_t< void >::final_suspend | ( |  | ) | const

inline nodiscard noexcept

Function called by the standard library when reaching the end of a coroutine.

Returns
  final_awaiter<R> Resumes any coroutine co_await-ing on this

## ◆ get_return_object()

dpp::coroutine< void > dpp::detail::coroutine::promise_t< void >::get_return_object | ( |  | ) |

inline nodiscard

Function called to get the coroutine object.

## ◆ initial_suspend()

std_coroutine::suspend_always dpp::detail::coroutine::promise_t< void >::initial_suspend | ( |  | ) | const

inline nodiscard noexcept

Function called by the standard library when the coroutine start.

Returns
  std::suspend_always Always suspend at the start, for a lazy start

## ◆ return_value()

void dpp::detail::coroutine::promise_t< void >::return_value | ( | void && | expr | ) |

inline noexcept

Function called by the standard library when the coroutine co_returns a value.

Stores the value internally to hand to the caller when it resumes.

Parameters

  expr | The value given to co_return

## ◆ return_void()

void dpp::detail::coroutine::promise_t< void >::return_void | ( |  | ) | const

inline noexcept

Function called when co_return is used.

## ◆ unhandled_exception()

void dpp::detail::coroutine::promise_t< void >::unhandled_exception | ( |  | ) |

inline noexcept

Function called when an exception escapes the coroutine.

Stores the exception to throw to the co_await-er

## Member Data Documentation

## ◆ exception

std::exception_ptr dpp::detail::coroutine::promise_t< void >::exception {nullptr}

Pointer to an uncaught exception thrown by the coroutine.

## ◆ parent

std_coroutine::coroutine_handle dpp::detail::coroutine::promise_t< void >::parent {nullptr}

Handle of the coroutine co_await-ing this coroutine.

## ◆ result

std::optional<void> dpp::detail::coroutine::promise_t< void >::result

Return value of the coroutine.

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