#include <result.h>
|
template<typename... Args, typename U = T, typename std::enable_if_t< std::is_same_v< U, void >, int > = 0> |
| Result (result_constructor_type::OK) |
|
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
| Result (result_constructor_type::OK, const T &value) |
|
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
| Result (result_constructor_type::OK, std::remove_reference_t< T > &&value) |
|
| Result (result_constructor_type::ER, const Error &error) |
|
bool | operator== (const Result< T > &other) |
|
bool | operator!= (const Result< T > &other) |
|
bool | is_ok () const |
|
bool | is_error () const |
|
template<typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
const T & | get () const |
|
template<typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
T && | get () |
|
const Error & | get_error () const |
|
Error && | get_error () |
|
template<typename U , typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
Result< U > | map (const std::function< Result< U >(const T &)> &f) const |
|
template<typename U , typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
Result< U > | map (const std::function< Result< U >(T &&)> &f) |
|
|
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
static Result< T > | Ok (const T &value) |
|
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0> |
static Result< T > | Ok (std::remove_reference_t< T > &&value) |
|
template<typename T>
class hal::Result< T >
Definition at line 63 of file result.h.
◆ Result() [1/4]
template<typename T >
template<typename... Args, typename U = T, typename std::enable_if_t< std::is_same_v< U, void >, int > = 0>
◆ Result() [2/4]
template<typename T >
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
◆ Result() [3/4]
template<typename T >
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
◆ Result() [4/4]
◆ get() [1/2]
template<typename T >
template<typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Get the value of the result. It is up to the user to check whether the result is valid using Result::is_ok()
beforehand.
- Template Parameters
-
U | - The type of the result value. |
- Returns
- The result value.
Definition at line 172 of file result.h.
References hal::T.
◆ get() [2/2]
template<typename T >
template<typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Get the value of the result. It is up to the user to check whether the result is valid using Result::is_ok()
beforehand.
- Template Parameters
-
U | - The type of the result value. |
- Returns
- The result value.
Definition at line 159 of file result.h.
References hal::T.
◆ get_error() [1/2]
Get the error of the result. It is up to the user to check whether the result is an error using Result::is_error()
beforehand.
- Returns
- The error.
Definition at line 194 of file result.h.
◆ get_error() [2/2]
Get the error of the result. It is up to the user to check whether the result is an error using Result::is_error()
beforehand.
- Returns
- The error.
Definition at line 183 of file result.h.
◆ is_error()
Check whether the result is an error.
- Returns
true
if the result is an error, false
otherwise.
Definition at line 146 of file result.h.
◆ is_ok()
Check whether the result is valid, i.e., not an error.
- Returns
true
if the result is valid, false
otherwise.
Definition at line 136 of file result.h.
◆ map() [1/2]
template<typename T >
template<typename U , typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Map the result to a different user-defined data type using the provided mapping function.
- Template Parameters
-
- Parameters
-
[in] | f | - The mapping function. |
- Returns
- The result mapped to the target data type.
Definition at line 207 of file result.h.
References ERR.
◆ map() [2/2]
template<typename T >
template<typename U , typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Map the result to a different user-defined data type using the provided mapping function.
- Template Parameters
-
- Parameters
-
[in] | f | - The mapping function. |
- Returns
- The result mapped to the target data type.
Definition at line 227 of file result.h.
References ERR.
◆ Ok() [1/2]
template<typename T >
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Construct a valid result carrying a result value.
- Parameters
-
[in] | value | - The result value. |
- Returns
- The result.
Definition at line 95 of file result.h.
References OK.
◆ Ok() [2/2]
template<typename T >
template<typename... Args, typename U = T, typename std::enable_if_t<!std::is_same_v< U, void >, int > = 0>
Construct a valid result carrying a result value.
- Parameters
-
[in] | value | - The result value. |
- Returns
- The result.
Definition at line 104 of file result.h.
References OK.
◆ operator!=()
Check whether two results are unequal.
- Parameters
-
[in] | other | - The result to compare against. |
- Returns
- True if both results are unequal, false otherwise.
Definition at line 126 of file result.h.
◆ operator==()
Check whether two results are equal.
- Parameters
-
[in] | other | - The result to compare against. |
- Returns
- True if both results are equal, false otherwise.
Definition at line 115 of file result.h.
The documentation for this class was generated from the following file:
- /home/runner/work/hal/hal/include/hal_core/utilities/result.h