|
FastLED 3.9.15
|
Implementation class for Promise - holds the actual state and logic.
#include <promise.h>
Inheritance diagram for fl::task::detail::PromiseImpl< T >:
Collaboration diagram for fl::task::detail::PromiseImpl< T >:Public Member Functions | |
| PromiseImpl () FL_NOEXCEPT | |
| const Error & | error () const FL_NOEXCEPT |
| Get error (only valid if rejected) | |
| bool | is_completed () const FL_NOEXCEPT |
| Check if Promise is completed. | |
| bool | is_rejected () const FL_NOEXCEPT |
| Check if Promise is rejected. | |
| bool | is_resolved () const FL_NOEXCEPT |
| Check if Promise is resolved. | |
| bool | reject (const Error &error) FL_NOEXCEPT |
| Reject Promise with error. | |
| bool | resolve (const T &value) FL_NOEXCEPT |
| Resolve Promise with value. | |
| bool | resolve (T &&value) FL_NOEXCEPT |
| void | set_catch_callback (fl::function< void(const Error &)> callback) FL_NOEXCEPT |
| Set error callback. | |
| void | set_then_callback (fl::function< void(const T &)> callback) FL_NOEXCEPT |
| Set success callback. | |
| void | update () FL_NOEXCEPT |
| Update Promise state - processes callbacks if needed. | |
| const T & | value () const FL_NOEXCEPT |
| Get value (only valid if resolved) | |
Private Member Functions | |
| void | process_callbacks () FL_NOEXCEPT |
| Process pending callbacks. | |
| void | set_state (PromiseState_t s) FL_NOEXCEPT |
| Write the state atomically. | |
| PromiseState_t | state () const FL_NOEXCEPT |
| Read the state atomically. | |
Private Attributes | |
| bool | mCallbacksProcessed |
| fl::function< void(const Error &)> | mCatchCallback |
| Error | mError |
| fl::atomic< int > | mState |
| fl::function< void(const T &)> | mThenCallback |
| T | mValue |