Support Class Library
A set of tools providing classes and utility
|
#include "Result.h"
Public Types | |
using | value_type = Value |
using | error_type = Error |
using | impl_type = Either< value_type, error_type > |
Public Member Functions | |
bool | isOk () const |
bool | isErr () const |
const value_type & | value () const |
const value_type & | get () const |
const error_type & | error () const |
operator bool () const | |
operator const value_type & () const | |
const value_type & | operator* () const |
const value_type *const | operator-> () const |
Optional< value_type > | toOptional () const |
Optional< value_type > | asOptional () const |
template<class T = value_type> | |
Result< T, error_type > | map (std::function< T(const value_type &)> mapper) const |
template<class T = value_type> | |
Result< T, error_type > | then (std::function< T(const value_type &)> mapper) const |
template<class E = error_type> | |
Result< value_type, E > | mapError (std::function< E(const error_type &)> mapper) const |
template<class T = value_type, class E = error_type> | |
Result< T, E > | mapBoth (std::function< T(const value_type &)> valueMapper, std::function< E(const error_type &)> errorMapper) const |
template<class T = value_type, class E = error_type> | |
Result< T, E > | flatMap (std::function< Result< T, E >(const value_type &)> mapper) const |
template<class T = value_type, class E = error_type> | |
Result< T, E > | andThen (std::function< Result< T, E >(const value_type &)> mapper) const |
template<class T = value_type, class E = error_type> | |
Result< T, E > | flatMapError (std::function< Result< T, E >(const error_type &)> mapper) const |
const value_type & | okOr (const value_type &value) const |
const value_type & | okOr (std::function< const value_type &()> factory) const |
const error_type & | errOr (const error_type &error) const |
const error_type & | errOr (std::function< const error_type &()> factory) const |
template<class E > | |
const value_type & | okOrThrow (E ex) const |
Static Public Member Functions | |
template<class T > | |
static Result | Ok (T &&value) |
template<class T > | |
static Result | ok (T &&value) |
template<class... Args> | |
static Result | emplaceOk (Args &&... args) |
template<class E > | |
static Result | Err (E &&err) |
template<class E > | |
static Result | err (E &&error) |
template<class... Args> | |
static Result | emplaceErr (Args &&... args) |
Protected Member Functions | |
Result ()=delete | |
template<class T > | |
Result (details::result_value, T &&value) | |
template<class E > | |
Result (details::result_error, E &&err) | |
Protected Attributes | |
impl_type | alt |
using scl::utils::Result< Value, Error >::error_type = Error |
using scl::utils::Result< Value, Error >::impl_type = Either<value_type, error_type> |
using scl::utils::Result< Value, Error >::value_type = Value |
|
protecteddelete |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |