Bitcoin Core  24.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | Friends | List of all members
util::Result< T > Class Template Reference

#include <result.h>

Public Member Functions

 Result (T obj)
 
 Result (Error error)
 
bool has_value () const noexcept
 std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal changes to existing code, and vice versa. More...
 
const T & value () const LIFETIMEBOUND
 
T & value () LIFETIMEBOUND
 
template<class U >
value_or (U &&default_value) const &
 
template<class U >
value_or (U &&default_value) &&
 
 operator bool () const noexcept
 
const T * operator-> () const LIFETIMEBOUND
 
const T & operator* () const LIFETIMEBOUND
 
T * operator-> () LIFETIMEBOUND
 
T & operator* () LIFETIMEBOUND
 

Private Attributes

std::variant< bilingual_str, T > m_variant
 

Friends

template<typename FT >
bilingual_str ErrorString (const Result< FT > &result)
 

Detailed Description

template<class T>
class util::Result< T >

Definition at line 35 of file result.h.

Constructor & Destructor Documentation

◆ Result() [1/2]

template<class T >
util::Result< T >::Result ( obj)
inline

Definition at line 44 of file result.h.

◆ Result() [2/2]

template<class T >
util::Result< T >::Result ( Error  error)
inline

Definition at line 45 of file result.h.

Member Function Documentation

◆ has_value()

template<class T >
bool util::Result< T >::has_value ( ) const
inlinenoexcept

std::optional methods, so functions returning optional<T> can change to return Result<T> with minimal changes to existing code, and vice versa.

Definition at line 49 of file result.h.

Here is the caller graph for this function:

◆ operator bool()

template<class T >
util::Result< T >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 70 of file result.h.

◆ operator*() [1/2]

template<class T >
const T& util::Result< T >::operator* ( ) const
inline

Definition at line 72 of file result.h.

◆ operator*() [2/2]

template<class T >
T& util::Result< T >::operator* ( )
inline

Definition at line 74 of file result.h.

◆ operator->() [1/2]

template<class T >
const T* util::Result< T >::operator-> ( ) const
inline

Definition at line 71 of file result.h.

◆ operator->() [2/2]

template<class T >
T* util::Result< T >::operator-> ( )
inline

Definition at line 73 of file result.h.

◆ value() [1/2]

template<class T >
const T& util::Result< T >::value ( ) const
inline

Definition at line 50 of file result.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value() [2/2]

template<class T >
T& util::Result< T >::value ( )
inline

Definition at line 55 of file result.h.

Here is the call graph for this function:

◆ value_or() [1/2]

template<class T >
template<class U >
T util::Result< T >::value_or ( U &&  default_value) &&
inline

Definition at line 66 of file result.h.

◆ value_or() [2/2]

template<class T >
template<class U >
T util::Result< T >::value_or ( U &&  default_value) const &
inline

Definition at line 61 of file result.h.

Friends And Related Function Documentation

◆ ErrorString

template<class T >
template<typename FT >
bilingual_str ErrorString ( const Result< FT > &  result)
friend

Member Data Documentation

◆ m_variant

template<class T >
std::variant<bilingual_str, T> util::Result< T >::m_variant
private

Definition at line 38 of file result.h.


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