Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::Result< T > Class Template Reference

A class for representing either a usable value, or an error. More...

#include <rerun/result.hpp>

Public Member Functions

 Result ()=delete
 Don't allow uninitialized results.
 
 Result (T _value)
 Construct a result from a value, setting error to ok.
 
 Result (rerun::Error _error)
 Construct a result from an error, default constructing the value.
 
 Result (const arrow::Status &status)
 Construct a result from an arrow status, default constructing the value.
 
 Result (arrow::Status &&status)
 Construct a result from an arrow status, default constructing the value.
 
bool is_ok () const
 Returns true if error is set to rerun::ErrorCode::Ok, implying that a value is contained, false otherwise.
 
bool is_err () const
 Returns true if error is not set to rerun::ErrorCode::Ok, implying that no value is contained, false otherwise.
 
const T & value_or_throw () const &
 Returns the value if status is ok, throws otherwise.
 
value_or_throw () &&
 Returns the value if status is ok, throws otherwise.
 
const T & value_or_exit () const &
 Returns the value if status is ok, exits the application otherwise.
 
value_or_exit () &&
 Returns the value if status is ok, exits the application otherwise.
 

Public Attributes

value
 
rerun::Error error
 

Detailed Description

template<typename T>
class rerun::Result< T >

A class for representing either a usable value, or an error.

In essence a simplified version of rust's Result or arrow's arrow::Result, always using rerun::Status. For simplicity, the wrapped type must be default constructible.

Member Function Documentation

◆ value_or_throw() [1/2]

template<typename T >
const T & rerun::Result< T >::value_or_throw ( ) const &
inline

Returns the value if status is ok, throws otherwise.

If exceptions are disabled, this will exit the application instead.

See also
error::value_or_exit

◆ value_or_throw() [2/2]

template<typename T >
T rerun::Result< T >::value_or_throw ( ) &&
inline

Returns the value if status is ok, throws otherwise.

If exceptions are disabled, this will exit the application instead.

See also
error::value_or_exit

◆ value_or_exit() [1/2]

template<typename T >
const T & rerun::Result< T >::value_or_exit ( ) const &
inline

Returns the value if status is ok, exits the application otherwise.

See also
error::value_or_throw

◆ value_or_exit() [2/2]

template<typename T >
T rerun::Result< T >::value_or_exit ( ) &&
inline

Returns the value if status is ok, exits the application otherwise.

See also
error::value_or_throw

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