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

Classes

struct  empty
 Empty result from void-returning awaitable. More...
 
class  promise_base
 Base class defining logic common to all promise types, aka the "write" end of an awaitable. More...
 

Typedefs

template<typename T >
using result_t = std::variant< std::monostate, std::conditional_t< std::is_void_v< T >, empty, T >, std::exception_ptr >
 Variant for the 3 conceptual values of a coroutine: More...
 

Enumerations

enum  state_flags {
  sf_none = 0b0000000, sf_has_awaitable = 0b00000001, sf_awaited = 0b00000010, sf_ready = 0b00000100,
  sf_done = 0b00001000, sf_broken = 0b0010000
}
 State of a promise. More...
 

Functions

template<typename T >
void spawn_sync_wait_job (auto *awaitable, std::condition_variable &cv, auto &&result)
 

Typedef Documentation

◆ result_t

template<typename T >
using dpp::detail::promise::result_t = typedef std::variant<std::monostate, std::conditional_t<std::is_void_v<T>, empty, T>, std::exception_ptr>

Variant for the 3 conceptual values of a coroutine:

Enumeration Type Documentation

◆ state_flags

enum dpp::detail::promise::state_flags

State of a promise.

Enumerator
sf_none 

Promise is empty.

sf_has_awaitable 

Promise has spawned an awaitable.

sf_awaited 

Promise is being awaited.

sf_ready 

Promise has a result.

sf_done 

Promise has completed, no more results are expected.

sf_broken 

Promise was broken - future or promise is gone.

Function Documentation

◆ spawn_sync_wait_job()

template<typename T >
void dpp::detail::promise::spawn_sync_wait_job ( auto *  awaitable,
std::condition_variable &  cv,
auto &&  result 
)
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