|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Producer-side handle paired with a Completion<T> by makeSettleable(). More...
#include <completion.hpp>
Public Member Functions | |
| Promise (Promise &&) noexcept=default | |
| Move constructor — transfers ownership of the shared state. | |
| Promise & | operator= (Promise &&) noexcept=default |
| Move assignment — transfers ownership of the shared state. | |
| Promise (const Promise &)=delete | |
| Promise & | operator= (const Promise &)=delete |
| void | resolve (T val) |
Resolves the paired Completion<T> with val. | |
| void | reject (std::exception_ptr exc) |
Rejects the paired Completion<T> with exc. | |
Producer-side handle paired with a Completion<T> by makeSettleable().
Promise<T> is the public settling counterpart to Completion<T>: it exposes exactly resolve()/reject() against the same shared state a paired Completion<T> observes via then()/onError(), without ever naming morph::async::detail::CompletionState<T>. Intended for test code that needs to construct a Completion<T> it can settle on demand — e.g. standing in for a Bridge/IBackend round trip — instead of reaching into detail::CompletionState<T> directly (see docs/spec/core/completion.md, "Settleable promise seam").
Move-only, mirroring Completion<T>: exactly one producer settles a given operation.
Definition at line 679 of file completion.hpp.
|
defaultnoexcept |
Move assignment — transfers ownership of the shared state.
|
inline |
Resolves the paired Completion<T> with val.
No-op if the state is already settled (first result wins — see detail::CompletionState<T>::setValue), or if this Promise was moved from (mirrors Completion<T>::then()'s null-state no-op). Safe to call from any thread; the delivery is posted to the completion's executor.
| val | Success value delivered to every attached then() handler. |
Definition at line 698 of file completion.hpp.
|
inline |
Rejects the paired Completion<T> with exc.
No-op if the state is already settled (first result wins — see detail::CompletionState<T>::setException), or if this Promise was moved from (mirrors Completion<T>::onError()'s null-state no-op). Safe to call from any thread; the delivery is posted to the completion's executor.
| exc | Error delivered to every attached onError() handler, or logged as an orphan if none is ever attached. |
Definition at line 713 of file completion.hpp.