class result

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

Specialization of result for one value type.

Functions

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(const result<type-parameter-0-0, type-parameter-0-1> & )

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

operator=

public result<type-parameter-0-0, type-parameter-0-1> & operator=(const result<type-parameter-0-0, type-parameter-0-1> & )

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

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(result<type-parameter-0-0, type-parameter-0-1> && )

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

operator=

public result<type-parameter-0-0, type-parameter-0-1> & operator=(result<type-parameter-0-0, type-parameter-0-1> && )

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

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(failed_or_none )

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

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

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(success<U> success)

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

Implicit conversion from success<U>, where T is constructible from U.

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(error<F> error)

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

Implicit conversion from error<F>, where E is constructible from F.

result<type-parameter-0-0, type-parameter-0-1>

public void result<type-parameter-0-0, type-parameter-0-1>(result<F, U> other)

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

Implicitly constructs a result from another result with compatible types.

is_ok

public bool is_ok()

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

Predicates indicating whether the result contains a value or an error. The positive values are mutually exclusive, however, both predicates are negative when the result is default constructed to the empty state.

is_error

public bool is_error()

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

error_value

public E & error_value()

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

Accessors for the underlying error.

May only be called when the result contains an error.

error_value

public const E & error_value()

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

error_value

public E && error_value()

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

error_value

public const E && error_value()

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

take_error

public error<E> take_error()

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

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.

value

public T & value()

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

Accessors for the underlying value.

May only be called when the result contains a value.

value

public const T & value()

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

value

public T && value()

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

value

public const T && value()

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

take_value

public success<T> take_value()

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

Moves the underlying value and returns it as an instance of fit::success, simplifying propagating the value to another fit::result.

May only be called when the result contains a value.

value_or

public T value_or(U && default_value)

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

Contingent accessors for the underlying value.

Returns the value when the result has a value, otherwise returns the given default value.

value_or

public T value_or(U && default_value)

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

operator->

public decltype(auto) operator->()

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

Accessors for the members of the underlying value. These operators forward to T::operator->() when defined, otherwise they provide direct access to T*.

May only be called when the result contains a value.

operator->

public decltype(auto) operator->()

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

operator*

public T & operator*()

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

Accessors for the underlying value. This is a syntax sugar for value().

May only be called when the result contains a value.

operator*

public const T & operator*()

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

operator*

public T && operator*()

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

operator*

public const T && operator*()

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

operator+=

public result<type-parameter-0-0, type-parameter-0-1> & operator+=(error<F> error)

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

Augments the error value of the result with the given error 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.

map_error

public result<std::invoke_result_t<Fn, E>, T> map_error(Fn && fn)

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

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 and successes in the current result object will be moved.

map_error

public result<std::invoke_result_t<Fn, E>, T> map_error(Fn && fn)

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

map_error

public result<std::invoke_result_t<Fn, E>, T> map_error(Fn && fn)

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

map_error

public result<std::invoke_result_t<Fn, E>, T> map_error(Fn && fn)

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

swap

public void swap(result<type-parameter-0-0, type-parameter-0-1> & other)

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

result<type-parameter-0-0, type-parameter-0-1>

protected void result<type-parameter-0-0, type-parameter-0-1>()

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

Default constructs a result in empty state.

reset

protected void reset()

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

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.

class result

class result

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

Specialization of the result type for zero values.

Records

Functions

result<type-parameter-0-0>

public void result<type-parameter-0-0>(const result<type-parameter-0-0> & )

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

operator=

public result<type-parameter-0-0> & operator=(const result<type-parameter-0-0> & )

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

result<type-parameter-0-0>

public void result<type-parameter-0-0>(result<type-parameter-0-0> && )

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

operator=

public result<type-parameter-0-0> & operator=(result<type-parameter-0-0> && )

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

result<type-parameter-0-0>

public void result<type-parameter-0-0>(failure_or_none )

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

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

result<type-parameter-0-0>

public void result<type-parameter-0-0>( success )

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

Implicit conversion from fit::success<>.

result<type-parameter-0-0>

public void result<type-parameter-0-0>(error<F> error)

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

Implicit conversion from error<F>, where E is constructible from F.

result<type-parameter-0-0>

public void result<type-parameter-0-0>(result<F> other)

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

Implicitly constructs a result from another result with compatible types.

is_ok

public bool is_ok()

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

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

is_error

public bool is_error()

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

error_value

public E & error_value()

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

Accessors for the underlying error.

May only be called when the result contains an error.

error_value

public const E & error_value()

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

error_value

public E && error_value()

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

error_value

public const E && error_value()

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

take_error

public error<E> take_error()

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

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.

operator+=

public result<type-parameter-0-0> & operator+=(error<F> error)

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

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.

map_error

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

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

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.

map_error

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

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

map_error

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

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

map_error

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

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

swap

public void swap(result<type-parameter-0-0> & other)

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

result<type-parameter-0-0>

protected void result<type-parameter-0-0>()

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

Default constructs a result in empty state.

reset

protected void reset()

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

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.

class result

class result

Result type representing either an error or zero/one return values.

Base type.