FastLED 3.9.15
Loading...
Searching...
No Matches

◆ value() [2/2]

template<typename T>
const T & fl::result< T >::value ( ) const
inline

Get the success value (const)

Returns
Reference to the success value
Warning
Returns static empty object if called on an error result
Note
Use ok() to check before calling for proper error handling

Definition at line 76 of file promise_result.h.

76 {
77 if (!ok()) {
78 // Return static empty object instead of crashing
79 static const T empty{};
80 return empty;
81 }
82 return mResult.template get<T>();
83 }
bool ok() const
Check if the result is successful.
fl::Variant< T, Error > mResult
Result type for promise operations.
pair_element< I, T1, T2 >::type & get(pair< T1, T2 > &p) noexcept
Definition pair.h:113

References fl::get(), mResult, and ok().

Referenced by result(), result(), test_await_approach(), and test_json_await().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: