class PendingResponse

Defined at line 26 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/internal/pending_response.h

A response to a FIDL message.

When a server receives a message that expects a response, the stub receives a

|PendingResponse| object that the implementation can use to reply to the

message. A given |PendingResponse| object can be used to send a reply at

most once.

If the |StubController| that processed the original message is destroyed or

unbound from the underlying channel (e.g., due to an error), the stub can

still safely call |Send|, but the response will not actually be sent to the

client.

Public Methods

void PendingResponse ()

Creates a |PendingResponse| that does not need a response.

The |needs_response()| method will return false.

Defined at line 14 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

void PendingResponse (zx_txid_t txid, WeakStubController * weak_controller)

Creates a |PendingResponse| for a message with the given transaction ID.

The |PendingResponse| object will take a reference to |weak_controller|,

which it releases in its destructor.

Defined at line 16 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

void ~PendingResponse ()

Defined at line 22 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

void PendingResponse (const PendingResponse & other)

|PendingResponse| objects are copiable.

Each copy refers to the same logical response, which means |Send| should be

called at most once among all the copies.

The reason |PendingResponse| objects are copiable is so that they can be

held by an fit::function, which is also copyable. Typically, a

|PendingResponse| object is held as a member of another object that

implements operator(), which can be wrapped by fit::function.

Defined at line 27 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

PendingResponse & operator= (const PendingResponse & other)

Defined at line 30 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

void PendingResponse (PendingResponse && other)

|PendingResponse| objects are movable.

Moving a |PendingResponse| object is more efficient that copying it because

moving avoid churning the reference count of the associated

|WeakStubController|.

Defined at line 42 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

PendingResponse & operator= (PendingResponse && other)

Defined at line 47 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

zx_status_t Send (const fidl_type_t * type, HLCPPOutgoingMessage message)

Send a response.

This function should be called at most once among all the copies of a given

|PendingResponse| object.

If the associated |WeakStubController| is no longer available (e.g., if it

has been destroyed), this function will return |ZX_ERR_BAD_STATE|.

Defined at line 58 of file ../../sdk/lib/fidl/hlcpp/internal/pending_response.cc

bool needs_response ()

Whether the message that caused this |PendingResponse| object to be created

expects a response.

This method does not indiciate whether a response has or has not already

been sent. That state is difficult to track because |PendingResponse| is

copiable.

Defined at line 67 of file ../../sdk/lib/fidl/hlcpp/include/lib/fidl/cpp/internal/pending_response.h