Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. pw_rpc2
  5. Readers and writers
  6. pw::rpc2::WriteFuture< Message > Class Template Reference
Loading...
Searching...
No Matches
pw::rpc2::WriteFuture< Message > Class Template Reference

Overview

template<typename Message = void>
class pw::rpc2::WriteFuture< Message >

Future representing an outbound write or stream completion.

Waits for a write reservation, serializes Message into the reserved buffer (unless Message is void, as for Writer::Finish()), and commits the write.

A ConstBuf message is copied into the reserved buffer; if it owns its memory, that memory is released as soon as the write completes.

Inheritance diagram for pw::rpc2::WriteFuture< Message >:
pw::rpc2::internal::WriteFutureBase

Public Member Functions

 WriteFuture (const WriteFuture &)=delete
 
WriteFuture & operator= (const WriteFuture &)=delete
 
 WriteFuture (WriteFuture &&other) noexcept=default
 
WriteFuture & operator= (WriteFuture &&other) noexcept=default
 
async2::Poll< RpcStatus > Pend (async2::Context &cx)
 
- Public Member Functions inherited from pw::rpc2::internal::WriteFutureBase
 WriteFutureBase (const WriteFutureBase &)=delete
 
WriteFutureBase & operator= (const WriteFutureBase &)=delete
 
bool is_pendable () const
 
bool is_complete () const
 

Friends

template<typename >
class Writer
 
template<typename >
class UnaryWriter
 
struct internal::CallAccess
 

Additional Inherited Members

- Public Types inherited from pw::rpc2::internal::WriteFutureBase
using value_type = RpcStatus
 
- Protected Member Functions inherited from pw::rpc2::internal::WriteFutureBase
 WriteFutureBase (ReserveWriteFuture &&res_fut)
 
 WriteFutureBase (WriteFutureBase &&) noexcept=default
 
WriteFutureBase & operator= (WriteFutureBase &&) noexcept=default
 
async2::Poll< RpcResult< IntrusivePtr< Call > > > PendWriteAndTakeCall (async2::Context &cx, const void *message, SerializeFn serialize)
 
async2::Poll< RpcStatus > PendWrite (async2::Context &cx, const void *message, SerializeFn serialize)
 

Member Function Documentation

◆ Pend()

template<typename Message = void>
async2::Poll< RpcStatus > pw::rpc2::WriteFuture< Message >::Pend ( async2::Context &  cx)
inline

Polls the outbound write until it is committed.

Returns
  • kOk once the message or completion has been committed.
  • kWriteClosed if the writer is already closed, empty, or moved from.
  • kMessageTooLarge if the encoded message does not fit in the write buffer or exceeds the maximum write size. Nothing was sent, and the call is still open.
  • kDataError if the message serializer failed for any other reason. Nothing was sent, and the call is still open.
  • The call's completion status (such as kCancelled or kDisconnected) if the call ended with an error. See Error handling.
  • kDisconnected if the connection closed before the write was sent.

The documentation for this class was generated from the following file: