ICU4X
International Components for Unicode
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
diplomat::result< T, E > Class Template Reference

#include <diplomat_runtime.hpp>

Public Member Functions

 result (Ok< T > &&v)
 
 result (Err< E > &&v)
 
 result ()=default
 
 result (const result &)=default
 
resultoperator= (const result &)=default
 
resultoperator= (result &&) noexcept=default
 
 result (result &&) noexcept=default
 
 ~result ()=default
 
bool is_ok () const
 
bool is_err () const
 
template<typename U = T, typename std::enable_if_t<!std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< T > ok () &&
 
template<typename U = E, typename std::enable_if_t<!std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< E > err () &&
 
template<typename U = T, typename std::enable_if_t< std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< std::reference_wrapper< std::remove_reference_t< T > > > ok () &&
 
template<typename U = E, typename std::enable_if_t< std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< std::reference_wrapper< std::remove_reference_t< E > > > err () &&
 
void set_ok (T &&t)
 
void set_err (E &&e)
 
template<typename T2 >
result< T2, E > replace_ok (T2 &&t)
 

Constructor & Destructor Documentation

◆ result() [1/5]

template<class T , class E >
diplomat::result< T, E >::result ( Ok< T > &&  v)
inline

◆ result() [2/5]

template<class T , class E >
diplomat::result< T, E >::result ( Err< E > &&  v)
inline

◆ result() [3/5]

template<class T , class E >
diplomat::result< T, E >::result ( )
default

◆ result() [4/5]

template<class T , class E >
diplomat::result< T, E >::result ( const result< T, E > &  )
default

◆ result() [5/5]

template<class T , class E >
diplomat::result< T, E >::result ( result< T, E > &&  )
defaultnoexcept

◆ ~result()

template<class T , class E >
diplomat::result< T, E >::~result ( )
default

Member Function Documentation

◆ err() [1/2]

template<class T , class E >
template<typename U = E, typename std::enable_if_t<!std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< E > diplomat::result< T, E >::err ( ) &&
inline

◆ err() [2/2]

template<class T , class E >
template<typename U = E, typename std::enable_if_t< std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< std::reference_wrapper< std::remove_reference_t< E > > > diplomat::result< T, E >::err ( ) &&
inline

◆ is_err()

template<class T , class E >
bool diplomat::result< T, E >::is_err ( ) const
inline

◆ is_ok()

template<class T , class E >
bool diplomat::result< T, E >::is_ok ( ) const
inline

◆ ok() [1/2]

template<class T , class E >
template<typename U = T, typename std::enable_if_t<!std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< T > diplomat::result< T, E >::ok ( ) &&
inline

◆ ok() [2/2]

template<class T , class E >
template<typename U = T, typename std::enable_if_t< std::is_reference_v< U >, std::nullptr_t > = nullptr>
std::optional< std::reference_wrapper< std::remove_reference_t< T > > > diplomat::result< T, E >::ok ( ) &&
inline

◆ operator=() [1/2]

template<class T , class E >
result & diplomat::result< T, E >::operator= ( const result< T, E > &  )
default

◆ operator=() [2/2]

template<class T , class E >
result & diplomat::result< T, E >::operator= ( result< T, E > &&  )
defaultnoexcept

◆ replace_ok()

template<class T , class E >
template<typename T2 >
result< T2, E > diplomat::result< T, E >::replace_ok ( T2 &&  t)
inline

◆ set_err()

template<class T , class E >
void diplomat::result< T, E >::set_err ( E &&  e)
inline

◆ set_ok()

template<class T , class E >
void diplomat::result< T, E >::set_ok ( T &&  t)
inline

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