Result
Public Methods
| Return | Name | Description |
|---|---|---|
Result | Deleted constructor. | |
Result | ||
Result | ||
bool | is_ok const | Check if result is successful. |
bool | is_err const | Check if result is an error. |
const T & | unwrap const | Get the value (throws if error) Use is_ok() to check first, or use unwrap_or() |
T & | unwrap | |
T | unwrap_or const | Get the value or a default. |
T | unwrap_or_else const | Get the value or compute from error. |
const std::string & | error const | Get error message. |
uint32_t | code const | Get error code. |
auto | map const | Map the value if Ok, preserve error if Err. |
operator bool const explicit | Convert to bool (true if Ok) |
Result
Result
inline
Result
inline
is_ok
const
is_err
const
unwrap
const
unwrap
inline
unwrap_or
const
unwrap_or_else
const
error
const
code
const
map
const
operator bool
const explicit
Public Static Methods
Ok
static
Ok
static
Err
static
Parameters
-
codeError code (use HTTP-style: 400=bad request, 404=not found, 500=internal error) -
msgHuman-readable error message
Private Attributes
| Return | Name | Description |
|---|---|---|
T | value_ | |
bool | is_ok_ | |
std::string | error_msg_ | |
uint32_t | error_code_ |
value_
is_ok_
error_msg_
error_code_
Private Methods
Result
inline
Result
inline