uv_req_t variants.#include <icy/request.h>Wrapper class for managing uv_req_t variants.
This class provides safe access to the parent handle in case the handle gets destroyed before the request callback returns, and should be used whenever the handle pointer is accessed via the callback.
| Return | Name | Description |
|---|---|---|
T | req | The underlying libuv request object. |
std::function< void(const E &)> | callback | Called when the request completes. |
T reqThe underlying libuv request object.
std::function< void(const E &)> callbackCalled when the request completes.
| Return | Name | Description |
|---|---|---|
Request inline | Construct the request and set req.data to this so callbacks can recover the wrapper pointer. | |
auto | invoke inline | Call f with args. If f returns a non-zero libuv error code, the callback is invoked immediately with that status. |
auto | invoke inline | Call f with args. Overload for void-returning functions; no error checking is performed. |
inline
inline Request()Construct the request and set req.data to this so callbacks can recover the wrapper pointer.
inline
template<typename F, typename... Args> inline auto invoke(F && f, Args &&... args)Call f with args. If f returns a non-zero libuv error code, the callback is invoked immediately with that status.
Enabled only when f returns a non-void type (i.e. an error code).
f libuv function to call.
args Arguments forwarded to f.
true (non-zero = success) if f returned 0; false on error.
inline
template<typename F, typename... Args> inline auto invoke(F && f, Args &&... args)Call f with args. Overload for void-returning functions; no error checking is performed.
f Function to call.
args Arguments forwarded to f.
| Return | Name | Description |
|---|---|---|
void | defaultCallback static inline | Standard libuv completion callback. Invokes callback with the status event and then deletes the [Request](#request-2) wrapper. |
static inline
static inline void defaultCallback(T * req, int status)Standard libuv completion callback. Invokes callback with the status event and then deletes the [Request](#request-2) wrapper.
req The completed libuv request.
status libuv status code (0 on success, negative on error).
T Type()E Event()