|
| | Reply ()=default |
| | Construct an immediate default result. More...
|
| |
| | Reply (const Reply &other)=delete |
| | Replies are move-only because resolving consumes their state. More...
|
| |
| | Reply (Reply &&other) noexcept=default |
| | Move a reply, transferring its unresolved result or deferred action. More...
|
| |
| Reply & | operator= (const Reply &other)=delete |
| | Replies cannot be copy-assigned. More...
|
| |
| Reply & | operator= (Reply &&other) noexcept=default |
| | Move-assign a reply, transferring its unresolved state. More...
|
| |
| template<typename U > |
| | requires (!std::same_as< std::remove_cvref_t< U >, Reply > &&std::is_constructible_v< ResultType, U && >) Reply(U &&value) |
| | Construct an immediate reply from anything the result is constructible from, such as a value, or an Unexpected error. More...
|
| |
| template<typename F > |
| void | Resolve (const std::shared_ptr< Transport > &transport, F &&f) |
| | Hand the result to the given continuation, either now or once the deferred action completes. More...
|
| |
template<typename T, typename E>
class quicr::Reply< T, E >
The reply to a callback, which may be answered immediately or deferred.
A Reply either holds the callback result or a producer that receives a completion callback. Resolve() invokes a deferred producer synchronously on the calling thread. The producer must start any slow authorization, I/O, or other asynchronous work itself and invoke the completion later.
- Template Parameters
-
| T | The value type of a successful reply. |
| E | The reason code type of a failed reply. |
template<typename T , typename E >
template<typename F >
Hand the result to the given continuation, either now or once the deferred action completes.
Immediate continuations run on the calling thread. A deferred completion is queued through transport and runs on the transport notification thread. Capturing the transport keeps it alive until completion is queued.
- Template Parameters
-
| F | Callable accepting ResultType. |
- Parameters
-
| transport | Transport used to marshal a deferred completion to its notification thread; must remain usable and must not be null. |
| f | Continuation invoked with the result. |
- Precondition
- This reply has not previously been resolved.
- Note
- Consumes the stored state; resolving the same reply more than once is invalid.