template <typename E>

class result

Defined at line 475 of file ../../sdk/lib/fit/include/lib/fit/result.h

Specialization of the result type for zero values.

Public Methods

void result<E> (const result<E> & )

Defined at line 490 of file ../../sdk/lib/fit/include/lib/fit/result.h

result<E> & operator= (const result<E> & )

Defined at line 491 of file ../../sdk/lib/fit/include/lib/fit/result.h

void result<E> (result<E> && )

Defined at line 492 of file ../../sdk/lib/fit/include/lib/fit/result.h

result<E> & operator= (result<E> && )

Defined at line 493 of file ../../sdk/lib/fit/include/lib/fit/result.h

void result<E> (failure_or_none )

Implicit conversion from fit::failure. This overload is only enabled when the error type E is

fit::failed.

Defined at line 497 of file ../../sdk/lib/fit/include/lib/fit/result.h

void result<E> (success<> )

Implicit conversion from fit::success

<

>.

Defined at line 500 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename F, ::fit::internal::requires_conditions<std::is_constructible<E, F>> = true>
void result<E> (error<F> error)

Implicit conversion from error

<F

>, where E is constructible from F.

Defined at line 504 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename F, ::fit::internal::requires_conditions<not_same<result<F>>,
                                                                                 std::is_constructible<E, F>> = true>
void result<E> (result<F> other)

Implicitly constructs a result from another result with compatible types.

Defined at line 509 of file ../../sdk/lib/fit/include/lib/fit/result.h

bool is_ok ()

Predicates indicating whether the result contains a value or an error.

Defined at line 512 of file ../../sdk/lib/fit/include/lib/fit/result.h

bool is_error ()

Defined at line 513 of file ../../sdk/lib/fit/include/lib/fit/result.h

E & error_value ()

Accessors for the underlying error.

May only be called when the result contains an error.

Defined at line 518 of file ../../sdk/lib/fit/include/lib/fit/result.h

const E & error_value ()

Defined at line 524 of file ../../sdk/lib/fit/include/lib/fit/result.h

E && error_value ()

Defined at line 530 of file ../../sdk/lib/fit/include/lib/fit/result.h

const E && error_value ()

Defined at line 536 of file ../../sdk/lib/fit/include/lib/fit/result.h

error<E> take_error ()

Moves the underlying error and returns it as an instance of fit::error, simplifying

propagating the error to another fit::result.

May only be called when the result contains an error.

Defined at line 547 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename F, ::fit::internal::requires_conditions<
                                                std::is_class<E>, ::fit::internal::has_plus_equals<E, F>> = true>
result<E> & operator+= (error<F> error)

Augments the error value of the result with the given value. The operator E::operator+=(F) must

be defined. Additionally, E may not be a pointer, primitive, or enum type.

May only be called when the result contains an error.

Defined at line 560 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename Fn>
result<std::invoke_result_t<Fn, E>> map_error (Fn && fn)

Maps a result

<E

, T> to a result

<E2

, T> by transforming the error through

fn, where E2 is the result of invoking fn on E. Success values will be

passed through untouched.

Note that map_error is not necessary if E2 is constructible from E.

In that case, result

<E2

, T> will be constructible from result

<E

, T>.

If the current object is an r-value, errors in the current result object

will be moved.

Defined at line 578 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename Fn>
result<std::invoke_result_t<Fn, E>> map_error (Fn && fn)

Defined at line 585 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename Fn>
result<std::invoke_result_t<Fn, E>> map_error (Fn && fn)

Defined at line 592 of file ../../sdk/lib/fit/include/lib/fit/result.h

template <typename Fn>
result<std::invoke_result_t<Fn, E>> map_error (Fn && fn)

Defined at line 599 of file ../../sdk/lib/fit/include/lib/fit/result.h

void swap (result<E> & other)

Defined at line 606 of file ../../sdk/lib/fit/include/lib/fit/result.h

Protected Methods

void result<E> ()

Default constructs a result in empty state.

Defined at line 615 of file ../../sdk/lib/fit/include/lib/fit/result.h

void reset ()

Reset is not a recommended operation for the general result pattern. This method is provided

for derived types that need it for specific use cases.

Defined at line 619 of file ../../sdk/lib/fit/include/lib/fit/result.h

Records

Friends

template <typenametypename>
class result