result 0.0.1
A C++ result<T, E> type inspired by Rust
Loading...
Searching...
No Matches
res::result< T, E > Class Template Reference

result is a type that represents either success or failure. More...

#include <result.h>

Public Member Functions

auto is_ok () const -> bool
 
 operator bool () const
 
auto operator! () const -> bool
 
auto value () const -> const T &
 
auto value_or (T &&default_value) const -> T
 
auto error () const -> const E &
 
template<typename F , typename R = std::invoke_result_t<F, T>>
auto map (F &&functor) const -> result< R, E >
 
template<typename F , typename U = std::invoke_result_t<F, E>>
auto map_err (F &&functor) const -> result< T, U >
 

Friends

template<typename U >
class ok
 
template<typename U >
class err
 

Detailed Description

template<typename T, typename E>
class res::result< T, E >

result is a type that represents either success or failure.

result<T, E> is the type used for returning and propagating errors. It holds either a successful value of type T or an error of type E.

Template Parameters
T
E

The documentation for this class was generated from the following file: