template <typename Owner>

class Receiver

Defined at line 35 of file ../../sdk/lib/async_patterns/cpp/receiver.h

A |Receiver| is a hub for an owner object to asynchronously receive messages

and calls from other objects living on different async dispatchers. A

|Receiver| should be embedded as a member variable of an owner object which

wishes to receive messages. The receiver will silently discard pending

messages when it destructs, typically as part of its parent.

The |Receiver| is thread-unsafe, and must be used and managed from a

[synchronized dispatcher][synchronized-dispatcher].

Calls posted to the same |Receiver| will be processed in the order they are

made, regardless which |Function|s and |Callback|s they are made from.

Calls posted to different |Receiver|s living on the same dispatcher are not

guaranteed to be processed before or after one another.

[synchronized-dispatcher]:

https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/thread-safe-async#synchronized-dispatcher

Public Methods

void Receiver<Owner> (Owner * owner, async_dispatcher_t * dispatcher)

Constructs a receiver. |owner| should be `this`. |dispatcher| should be

the dispatcher that the current task is running on, and where |Owner|

typically lives.

Defined at line 40 of file ../../sdk/lib/async_patterns/cpp/receiver.h

void Receiver<Owner> (const Receiver<Owner> & )

Defined at line 43 of file ../../sdk/lib/async_patterns/cpp/receiver.h

Receiver<Owner> & operator= (const Receiver<Owner> & )

Defined at line 44 of file ../../sdk/lib/async_patterns/cpp/receiver.h

void Receiver<Owner> (Receiver<Owner> && )

Defined at line 45 of file ../../sdk/lib/async_patterns/cpp/receiver.h

Receiver<Owner> & operator= (Receiver<Owner> && )

Defined at line 46 of file ../../sdk/lib/async_patterns/cpp/receiver.h

template <typename Member>
auto Once (Member Owner::* member)

Mints a |Callback| object that holds a capability to send |Args| to the

owner object once. When the resulting |Callback| is invoked on some other

thread, |member| is scheduled to be called on the |dispatcher|.

|member| should be a pointer to member function. It should have the

function signature `void Owner::SomeMember(Args...)` where Args are some

number of arguments.

Defined at line 56 of file ../../sdk/lib/async_patterns/cpp/receiver.h

template <typename StatelessLambda>
auto Once (StatelessLambda callable)

Mints a |Callback| object that holds a capability to send |Args| to the

owner object once. When the resulting |Callback| is invoked on some other

thread, |callable| is scheduled to be called on the |dispatcher|.

|callable| should be a lambda without any captures. It should have the

function signature `void(Owner*, Args...)` where Args are some number of

arguments.

Defined at line 69 of file ../../sdk/lib/async_patterns/cpp/receiver.h

template <typename Member>
auto Repeating (Member Owner::* member)

Mints a |Function| object that holds a capability to send |Args| to the

owner object repeatedly. When the resulting |Function| is invoked on some

other thread, |member| is scheduled to be called on the |dispatcher|.

|member| should be a pointer to member function. It should have the

function signature `void Owner::SomeMember(Args...)` where Args are some

number of arguments.

Defined at line 87 of file ../../sdk/lib/async_patterns/cpp/receiver.h

template <typename StatelessLambda>
auto Repeating (StatelessLambda callable)

Mints a |Function| object that holds a capability to send |Args| to the

owner object repeatedly. When the resulting |Function| is invoked on some

other thread, |callable| is scheduled to be called on the |dispatcher|.

|callable| should be a lambda without any captures. It should have the

function signature `void(Owner*, Args...)` where Args are some number of

arguments.

Defined at line 100 of file ../../sdk/lib/async_patterns/cpp/receiver.h

Records