|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <types.h>

Public Member Functions | |
| Result (const T &val) | |
| Result (T &&val) | |
| Result (const Error &err) | |
| Result (ErrorCode code, const char *msg="") | |
| bool | isOk () const |
| bool | isError () const |
| const T & | value () const |
| T & | value () |
| const Error & | error () const |
Private Attributes | |
| T | value_ {} |
| Error | error_ {ErrorCode::Ok} |
Value-or-error return type for HAL and service operations.
This keeps hardware and host implementations on one exception-free contract. A successful instance carries a value; a failed instance carries an Error. Callers should inspect isOk() before reading value(), because failed results retain only a default-constructed value for deterministic storage.
|
inline |
Create a successful result by copying val.
|
inline |
Create a successful result by moving val into the result.
|
inline |
Create a failed result from an Error value.
|
inline |
Create a failed result from a code and optional diagnostic.
|
inline |
Inspect the outcome code and diagnostic for success or failure.
|
inline |
Test whether the operation completed with an error.
|
inline |
Test whether the operation completed successfully.
|
inline |
Mutate the returned value; valid only when isOk() is true.
|
inline |
Read the returned value; valid only when isOk() is true.
|
private |
|
private |