16 std::is_default_constructible<T>::value,
17 "Result can only wrap default constructible types."
25 Result(T _value) : value(std::move(_value)), error() {}
31 Result(
const arrow::Status& status) : value(), error(status) {}
34 Result(arrow::Status&& status) : value(), error(std::move(status)) {}
45 return error.is_err();
53 error.throw_on_failure();
62 error.throw_on_failure();
64 return std::move(value);
70 error.exit_on_failure();
77 error.exit_on_failure();
79 return std::move(value);
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:96
A class for representing either a usable value, or an error.
Definition result.hpp:14
Result(const arrow::Status &status)
Construct a result from an arrow status, default constructing the value.
Definition result.hpp:31
Result()=delete
Don't allow uninitialized results.
bool is_ok() const
Returns true if error is set to rerun::ErrorCode::Ok, implying that a value is contained,...
Definition result.hpp:38
const T & value_or_throw() const &
Returns the value if status is ok, throws otherwise.
Definition result.hpp:52
const T & value_or_exit() const &
Returns the value if status is ok, exits the application otherwise.
Definition result.hpp:69
T value_or_exit() &&
Returns the value if status is ok, exits the application otherwise.
Definition result.hpp:76
bool is_err() const
Returns true if error is not set to rerun::ErrorCode::Ok, implying that no value is contained,...
Definition result.hpp:44
Result(rerun::Error _error)
Construct a result from an error, default constructing the value.
Definition result.hpp:28
Result(arrow::Status &&status)
Construct a result from an arrow status, default constructing the value.
Definition result.hpp:34
T value_or_throw() &&
Returns the value if status is ok, throws otherwise.
Definition result.hpp:61
Result(T _value)
Construct a result from a value, setting error to ok.
Definition result.hpp:25
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23