OXY API 1.0
OXY API Library Documentation
Loading...
Searching...
No Matches
oxy::get_envvar_fn Struct Reference

Function object to get the value of an environment variable. More...

#include <envvar.hpp>

Public Member Functions

result< maybe< std::string > > operator() (std::string const &name) const

Detailed Description

Function object to get the value of an environment variable.

This functor provides an overload to retrieve the value of a specified environment variable. It returns a result type that contains a maybe<std::string> holding the value of the environment variable if it exists, or an empty maybe if the variable is not set. In case of an error during retrieval, it returns an error code. This allows for safe access to environment variables, providing feedback on any issues encountered during the process.

Member Function Documentation

◆ operator()()

result< maybe< std::string > > oxy::get_envvar_fn::operator() ( std::string const & name) const
Parameters
name- The name of the environment variable to retrieve.
Returns
A result type containing a maybe<std::string> with the value of the environment variable if it exists, or an empty maybe if not. Returns an error code on failure