A ValueProvider that may or may not produce a value.
Adds a Cancel() function that resolves the pending future with std::nullopt.
Public Member Functions | |
| OptionalValueProvider (OptionalValueProvider &&)=default | |
| OptionalValueProvider & | operator= (OptionalValueProvider &&other) |
| OptionalValueProvider (const OptionalValueProvider &)=delete | |
| OptionalValueProvider & | operator= (const OptionalValueProvider &)=delete |
| OptionalValueFuture< T > | Get () |
| std::optional< OptionalValueFuture< T > > | TryGet () |
| template<typename... Args> | |
| void | Resolve (Args &&... args) |
Resolves the pending ValueFuture by constructing it in-place. | |
| void | Cancel () |
Resolves the pending ValueFuture with std::nullopt. | |
| bool | has_future () const |
Returns true if the provider stores a pending future. | |
|
inline |
Returns a ValueFuture that will be completed when Resolve or Cancel is called.
|
inline |
Returns a ValueFuture that will be completed when Resolve or Cancel is called.
If a future has already been vended and is still pending, this will return std::nullopt.