Template Class Result¶
Defined in File result.hpp
Template Parameter Order¶
typename T
typename E
Class Documentation¶
-
template<typename T, typename E>
class Result¶ Represents either a value or an error.
- Template Parameters:
T – The type of the value.
E – The type of the error.
Public Functions
-
inline constexpr bool is_ok()¶
-
inline constexpr bool is_err()¶
-
inline constexpr T unwrap(const FormatWithLocation &fmt = "unwrap failed: cannot unwrap an error type, err: {}")¶
Gets the Ok value if present and panics if called on an Err value.
-
inline constexpr T unwrap_or(T _value)¶
Gets the Ok value if present or returns a default value.
- Parameters:
_value – The value returned on error
- Returns:
The Ok value or _value