|
FastLED 3.9.15
|
Result type for promise operations.
| T | The success value type |
result provides a clean API for handling success/error results from async operations. It wraps a Variant<T, Error> but provides more ergonomic access patterns with ok() checking and automatic assertions.
Definition at line 40 of file promise_result.h.
#include <promise_result.h>
Collaboration diagram for fl::result< T >:Public Member Functions | |
| result (const Error &error) | |
| Construct an error result. | |
| result (const T &value) | |
| Construct a successful result. | |
| result (Error &&error) | |
| Construct an error result (move) | |
| result (T &&value) | |
| Construct a successful result (move) | |
| const Error & | error () const |
| Get the error value. | |
| fl::string | error_message () const |
| Get the error message as a convenience. | |
| bool | ok () const |
| Check if the result is successful. | |
| operator bool () const | |
| Boolean conversion operator (same as ok()) | |
| T & | value () |
| Get the success value (mutable) | |
| const T & | value () const |
| Get the success value (const) | |
| const fl::Variant< T, Error > & | variant () const |
| Access the underlying variant (for advanced usage) | |
Private Attributes | |
| fl::Variant< T, Error > | mResult |