Future representing a complete unary RPC on a client.
Sends the Request message to the server and awaits the server's single Response message, resolving to RpcResult<Response>.
Destroying a UnaryFuture before it completes cancels the call. If the request was already sent, the server is notified so it can stop work. Cancel() does the same while keeping the future, which then resolves to kCancelled.
Public Types | |
| using | value_type = RpcResult< Response > |
Public Member Functions | |
| async2::Poll< RpcResult< Response > > | Pend (async2::Context &cx) |
Public Member Functions inherited from pw::rpc2::internal::UnaryFutureBase | |
| void | Cancel () |
Public Member Functions inherited from pw::rpc2::internal::FutureBase | |
| FutureBase (const FutureBase &)=delete | |
| FutureBase & | operator= (const FutureBase &)=delete |
| constexpr bool | is_pendable () const |
| constexpr bool | is_complete () const |
Friends | |
| class | internal::GeneratedServiceClient |
Additional Inherited Members | |
Protected Member Functions inherited from pw::rpc2::internal::UnaryFutureBase | |
| UnaryFutureBase (ReserveWriteFuture &&request_reservation) | |
| UnaryFutureBase (UnaryFutureBase &&) noexcept=default | |
| UnaryFutureBase & | operator= (UnaryFutureBase &&) noexcept=default |
| bool | request_pending () const |
| True until the request has been sent or has failed to send. | |
| async2::Poll< RpcResult< ConstBuf > > | PendRaw (async2::Context &cx, const void *request, SerializeFn serialize) |
| void | PendAndDeserialize (async2::Context &cx, const void *request, SerializeFn serialize, void *result_out, DeserializeFn deserialize) |
Protected Member Functions inherited from pw::rpc2::internal::FutureBase | |
| constexpr | FutureBase (async2::FutureState::Pending) |
| constexpr | FutureBase (async2::FutureState state) |
| constexpr | FutureBase (FutureBase &&) noexcept=default |
| constexpr FutureBase & | operator= (FutureBase &&) noexcept=default |
| constexpr void | mark_pending () |
| void | mark_complete () |
|
inline |
Polls the request transmission and then the response.
kOk with the Response once the server replies.kUnimplemented if the server does not offer the service or method, or answered as if the method had a different type.kUnavailable if the server could not take the call. The method never ran, so retrying later is safe.kAborted if the server started the call but could not finish it. The method may have partly run.kCancelled if either end cancelled the call, including a server that dropped its UnaryWriter without responding, or whose method returned while a UnaryWriter it handed out still held the call open.kClosed if the client is empty or was closed.kResourceExhausted if the call could not be allocated locally.kMessageTooLarge if the request does not fit in the write buffer or exceeds the maximum write size.kDataError if the request could not be serialized, the server could not decode it, or the response could not be deserialized.kDisconnected if the connection closed before the response arrived.kProtocolError if an endpoint broke the protocol. See Error handling.