D++ (DPP)
C++ Discord API Bot Library
|
Base class of dpp::async. More...
Public Member Functions | |
template<typename Obj , typename Fun , typename... Args> | |
async_base (Obj &&obj, Fun &&fun, Args &&... args) | |
Construct an async object wrapping an object method, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result. More... | |
template<typename Fun , typename... Args> | |
async_base (Fun &&fun, Args &&... args) | |
Construct an async object wrapping an invokeable object, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result. More... | |
async_base () noexcept | |
Construct an empty async. Using co_await on an empty async is undefined behavior. More... | |
~async_base () | |
Destructor. If any callback is pending it will be aborted. More... | |
async_base (const async_base &)=delete | |
Copy constructor is disabled. More... | |
async_base (async_base &&other) noexcept=default | |
Move constructor. More... | |
async_base & | operator= (const async_base &)=delete |
Copy assignment is disabled. More... | |
async_base & | operator= (async_base &&other) noexcept=default |
Move assignment operator. More... | |
bool | await_ready () const noexcept |
Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not. More... | |
bool | await_suspend (detail::std_coroutine::coroutine_handle<> caller) noexcept |
Second function called by the standard library when the object is co-awaited, if await_ready returned false. More... | |
R & | await_resume () &noexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to. More... | |
const R & | await_resume () const &noexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to. More... | |
R && | await_resume () &&noexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to. More... | |
Base class of dpp::async.
|
inlineexplicit |
Construct an async object wrapping an object method, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.
obj | The object to call the method on |
fun | The method of the object to call. Its last parameter must be a callback taking a parameter of type R |
args | Parameters to pass to the method, excluding the callback |
|
inlineexplicit |
Construct an async object wrapping an invokeable object, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.
fun | The object to call using std::invoke. Its last parameter must be a callable taking a parameter of type R |
args | Parameters to pass to the object, excluding the callback |
|
inlinenoexcept |
Construct an empty async. Using co_await
on an empty async is undefined behavior.
|
inline |
Destructor. If any callback is pending it will be aborted.
|
delete |
Copy constructor is disabled.
|
defaultnoexcept |
Move constructor.
NOTE: Despite being marked noexcept, this function uses std::lock_guard which may throw. The implementation assumes this can never happen, hence noexcept. Report it if it does, as that would be a bug.
other | The async object to move the data from. |
|
inlinenoexcept |
Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not.
|
inlinenoexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to.
|
inlinenoexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to.
|
inlinenoexcept |
Function called by the standard library when the async is resumed. Its return value is what the whole co_await expression evaluates to.
|
inlinenoexcept |
Second function called by the standard library when the object is co-awaited, if await_ready returned false.
Checks again for the presence of the result, if absent, signals to suspend and keep track of the calling coroutine for the callback to resume.
caller | The handle to the coroutine co_await-ing and being suspended |
|
defaultnoexcept |
Move assignment operator.
NOTE: Despite being marked noexcept, this function uses std::lock_guard which may throw. The implementation assumes this can never happen, hence noexcept. Report it if it does, as that would be a bug.
other | The async object to move the data from |
|
delete |
Copy assignment is disabled.