8#include <userver/engine/impl/task_local_storage.hpp>
10USERVER_NAMESPACE_BEGIN
23class TaskLocalVariable final {
24 static_assert(!std::is_reference_v<T>);
25 static_assert(!std::is_const_v<T>);
40 return impl::task_local::GetCurrentStorage().GetOptional<T, kVariableKind>(impl_.GetKey());
44 static constexpr auto kVariableKind =
impl::task_local::VariableKind::kNormal;
46 impl::task_local::Variable impl_;
51 return impl::task_local::GetCurrentStorage().GetOrEmplace<T, kVariableKind>(impl_.GetKey());