#include <userver/engine/task/inherited_variable.hpp>
TaskInheritedVariable is a per-coroutine variable of arbitrary type.
These are like engine::TaskLocalVariable, but the variable instances are inherited by child tasks created via utils::Async.
The order of destruction of task-inherited variables is unspecified.
Definition at line 24 of file inherited_variable.hpp.
Public Member Functions | |
const T * | GetOptional () const noexcept |
Get the variable instance for the current task. | |
const T & | Get () const |
Get the variable instance for the current task. | |
template<typename... Args> | |
void | Emplace (Args &&... args) |
Sets or replaces the T variable instance. | |
void | Set (T &&value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Set (const T &value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Erase () |
Hide the variable so that it is no longer accessible from the current or new child tasks. | |
|
inline |
Sets or replaces the T variable instance.
Definition at line 39 of file inherited_variable.hpp.
|
inline |
Hide the variable so that it is no longer accessible from the current or new child tasks.
Definition at line 52 of file inherited_variable.hpp.
|
inline |
Get the variable instance for the current task.
std::runtime_error | if variable was not set. |
Definition at line 35 of file inherited_variable.hpp.
|
inlinenoexcept |
Get the variable instance for the current task.
nullptr
if variable was not set. Definition at line 31 of file inherited_variable.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 47 of file inherited_variable.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 44 of file inherited_variable.hpp.