Async++ unknown
Async (co_await/co_return) code for C++
|
Promise type that allows waiting for a result in both synchronous and asynchronous code. More...
#include <asyncpp/promise.h>
Public Types | |
using | result_type = void |
Public Member Functions | |
promise ()=default | |
Construct a new promise object in its pending state. | |
promise (const promise &other)=default | |
Copy constructor. | |
promise & | operator= (const promise &other)=default |
Copy assignment. | |
void | fulfill () |
bool | try_fulfill () |
void | then (std::function< void()> then_cb, std::function< void(const std::exception_ptr &)> catch_cb) |
void | get () const |
template<class Rep , class Period > | |
bool | get (std::chrono::duration< Rep, Period > timeout) const |
std::pair< bool, std::exception_ptr > | try_get (std::nothrow_t) const noexcept |
bool | try_get () const |
auto | operator co_await () const noexcept |
Static Public Member Functions | |
static promise | make_fulfilled () |
static promise | make_rejected (std::exception_ptr exception) |
template<typename TException , typename... Args> | |
static promise | make_rejected (Args &&... args) |
Promise type that allows waiting for a result in both synchronous and asynchronous code.
TResult | Type of the result |